string.withCString and UnsafeMutablePointer(mutating: cstring) wrapped into a function
问题 I have a problem with the String.withCString{} in combination with UnsafeMutablePointer(mutating: ...). Given: a C-Function like this randomSign(xml_string: UnsafeMutablePointer<Int8>!) -> Uint Also given: a String like str = "some xml_tag" My working code is like this (VERSION_1) func randomSignWrapper_1(xml_tag_str: String) -> Uint { let result = xml_str.withCString { s in return randomSign(UnsafeMutablePointer(mutating: s)) } return result } But I want the withCString to be put into a