Re: [swift-users] UnsafePointer and C-String

2017-01-03 Thread Rien via swift-users
Thanks Jeremy & Ole, That was indeed my expectation, but I had not thought of looking in the source code! Regards, Rien Site: http://balancingrock.nl Blog: http://swiftrien.blogspot.com Github: http://github.com/Swiftrien Project: http://swiftfire.nl > On 03 Jan 2017, at 16:31, Ole Begemann

Re: [swift-users] UnsafePointer and C-String

2017-01-03 Thread Ole Begemann via swift-users
What I cannot find though is the guarantee that the buffer where the String is converted to an UTF8 sequence is always null-terminated. I very much suspect it is, and all my tests did find a null-terminated string. Question: Does anybody know for sure that the buffer is always null-terminated? (

Re: [swift-users] UnsafePointer and C-String

2017-01-03 Thread Jeremy Pereira via swift-users
> On 3 Jan 2017, at 12:28, Rien via swift-users wrote: > > The documentation at > https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithCAPIs.html > shows that it is possible to use String where an UnsafePointer is > needed. > API calls to

[swift-users] UnsafePointer and C-String

2017-01-03 Thread Rien via swift-users
The documentation at https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithCAPIs.html shows that it is possible to use String where an UnsafePointer is needed. API calls to C that need a char* are translated to UnsafePointer. It follows that w