Reference
std/cstring
std/cstring
CString, a string with no zero byte, which C reads as a zero-terminated string.
narra
import * as CStrings from "std/cstring"
The guide teaches it in chapter 16, Unsafe code and C.
This page is generated by scripts/std/generate.nra from narrac query --json interface std/cstring. Do not edit it.
Types
CString
narra
export opaque struct CString
Functions: from, toString, pointer.
Functions
from
narra
export function from(text: string): Option<CString>
Effects: none.
toString
narra
export function toString(value: CString): string from value
Effects: none.
pointer
narra
export function pointer(value: CString): Ptr<u8>
Effects: none.
read
narra
export function read(address: Ptr<u8>): Result<string, string> uses alloc, unsafe
Effects: alloc, unsafe.