method str.toCString
Copy with a trailing NUL byte (interior NULs are kept; C will stop at the first one).
Example:
import c "stdlib.h" { atoi }
fn main() io {
let c = "1234".toCString()
print("{unsafe { atoi(c.asPtr()) }}")
}Вывод
1234
pub(api) fn toCString() -> CStringСложность. O(n) in the length of the string (one copy).
С версии. 1.0.0-beta
Возвращает
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/ffi/ffi.oxl:90