1

I have C function that returns const char* and I am trying to print that variable in swift. In swift file, it says the returned value from C function is in UnsafePointer. How to I convert this to string so that I can print that variable?

This getInfoCPP function is a c++ function wrapped in C so It is a C function that returns const char*. And on xcode it says info is a type of unsafepointer int8 How do i convert this into either unsafepointer UInt8 or to string?

    let info = getInfoCPP(db, "SRB")
Joon Lee
  • 61
  • 3
  • See https://stackoverflow.com/questions/39533320/swift-3-convert-a-null-terminated-unsafepointeruint8-to-a-string or https://stackoverflow.com/questions/33018494/converting-from-const-char-to-swift-string – Martin R Jun 06 '19 at 10:44

0 Answers0