<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">The documentation at <a href="https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithCAPIs.html" class="">https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithCAPIs.html</a> shows that it is possible to use <font face="Courier New" class="">String</font> where an <font face="Courier New" class="">UnsafePointer<Int8></font> is needed.</div><div class="">API calls to C that need a <font face="Courier New" class="">char*</font> are translated to <font face="Courier New" class="">UnsafePointer<Int8></font>.</div><div class="">It follows that we can use a <font face="Courier New" class="">String</font> where a <font face="Courier New" class="">char*</font> is needed.</div><div class=""><br class=""></div><div class="">However in C a string is not only a <font face="Courier New" class="">char*</font>, it is also null-terminated.</div><div class=""><br class=""></div><div class="">What I cannot find though is the guarantee that the buffer where the <font face="Courier New" class="">String</font> is converted to an UTF8 sequence is always null-terminated.</div><div class=""><br class=""></div><div class="">I very much suspect it is, and all my tests did find a null-terminated string.</div><div class=""><br class=""></div><div class="">Question: Does anybody know for sure that the buffer is always null-terminated? (a link to where I can check this would be most appreciated)</div><br class=""><div class="">Regards,<br class="">Rien<br class=""><br class="">Site: <a href="http://balancingrock.nl" class="">http://balancingrock.nl</a><br class="">Blog: <a href="http://swiftrien.blogspot.com" class="">http://swiftrien.blogspot.com</a><br class="">Github: <a href="http://github.com/Swiftrien" class="">http://github.com/Swiftrien</a><br class="">Project: <a href="http://swiftfire.nl" class="">http://swiftfire.nl</a><br class=""><br class=""><br class=""><br class=""></div><br class=""></body></html>