Macro c_string::c_str
[−]
[src]
macro_rules! c_str { ($lit:expr) => { ... }; }
Produce a CStr
reference out of a static string literal.
This macro provides a convenient way to use string literals in
expressions where a CStr
reference is expected.
The macro parameter does not need to end with "\0"
, it is
appended by the macro.
Example
#![feature(libc)] #[macro_use] extern crate c_string; extern crate libc; fn main() { unsafe { libc::puts(c_str!("Hello, world!").as_ptr()) }; }