How to get 'String' from type '(cString: UnsafeMutableRawPointer?)'

Null-terminated c string.

var pem_key = calloc(keylen+1, 1); / Null-terminate */

let cT1 = String(cString: pem_key)


How to get String in Swift3?


The error is:

Cannot invoke initializer for type 'String' with an argument list of type '(cString: UnsafeMutableRawPointer?)'

Overloads for 'String' exist with these partially matching parameter lists: (cString: UnsafePointer<CChar>), (cString: UnsafePointer<UInt8>)

Replies

Just for the record, I answered this over on a different thread.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"