我知道CString可以用UnsafePointer初始化,但是如何用ConstUnsafePointer创建它
代码错误:ConstUnsafePointer无法转换为UnsafePointer
var result:ConstUnsafePointer = sqlite3_column_text(stmt, num)
let cstr:CString = CString(result)
或如何将其转换为UnsafePointer
最佳答案
您只需要浏览UnsafePointer
:
var result: ConstUnsafePointer<UInt8> = sqlite3_column_text(stmt, num)
let cstr: CString = CString(UnsafePointer<UInt8>(result))