diff options
| author | bors <bors@rust-lang.org> | 2013-08-23 06:31:19 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-08-23 06:31:19 -0700 |
| commit | 943f9aaa4a0302cee1b28c2fec3f23fc1c43fd61 (patch) | |
| tree | 61a52f12b5016e68d3564bc8e593081b64f1c205 | |
| parent | 4edf3758d178213882530c47b9ea1e2e6356d5a1 (diff) | |
| parent | fe1beac45e6d2e84e87a95dbf38c2cdef62bf064 (diff) | |
auto merge of #8692 : kballard/rust/ffi-tutorial-c_str, r=huonw
The FFI tutorial still incorrectly stated that strings were terminated with
| -rw-r--r-- | doc/tutorial-ffi.md | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/doc/tutorial-ffi.md b/doc/tutorial-ffi.md index 278273b1671..e3c1c489444 100644 --- a/doc/tutorial-ffi.md +++ b/doc/tutorial-ffi.md @@ -445,9 +445,8 @@ prefer using raw pointers (`*`) if that's needed because the compiler can't make about them. Vectors and strings share the same basic memory layout, and utilities are available in the `vec` and -`str` modules for working with C APIs. Strings are terminated with `\0` for interoperability with C, -but it should not be assumed because a slice will not always be nul-terminated. Instead, the -`str::as_c_str` function should be used. +`str` modules for working with C APIs. However, strings are not terminated with `\0`. If you need a +NUL-terminated string for interoperability with C, you should use the `c_str::to_c_str` function. The standard library includes type aliases and function definitions for the C standard library in the `libc` module, and Rust links against `libc` and `libm` by default. |
