tempfile
Temporary Files and Directories
Functions
| Function | Description |
|---|---|
tmp_rand_suffix | Internal: generate random suffix (6 alphanumeric chars). |
tmp_write_prefix | Internal: write “/tmp/” prefix. |
tmp_name | Generate a unique temp path name. Returns length. |
tmp_make_handle | Handle layout: [0]=fd, [1]=path_ptr, [2]=path_len, [3]=is_dir |
tmp_file | Create a temporary file. Returns handle. |
tmp_dir | Create a temporary directory. Returns handle. |
tmp_path | Copy path to dst buffer. Returns length. |
tmp_fd | Get file descriptor. |
tmp_write | Write bytes to temp file. |
tmp_read | Read bytes from temp file (seeks to start first). |
tmp_close | Close the file descriptor. |
tmp_remove | Delete the temp file or directory. |
Details
tmp_rand_suffix
fn tmp_rand_suffix(dst: &i8, off: i64) -> i64Internal: generate random suffix (6 alphanumeric chars).
tmp_write_prefix
fn tmp_write_prefix(dst: &i8) -> i64Internal: write “/tmp/” prefix.
tmp_name
fn tmp_name(prefix: &i8, plen: i64, dst: &i8) -> i64Generate a unique temp path name. Returns length.
tmp_make_handle
fn tmp_make_handle(fd: i64, path: &i8, plen: i64, is_dir: i64) -> &i64Handle layout: [0]=fd, [1]=path_ptr, [2]=path_len, [3]=is_dir
tmp_file
fn tmp_file(prefix: &i8, plen: i64) -> &i64Create a temporary file. Returns handle.
tmp_dir
fn tmp_dir(prefix: &i8, plen: i64) -> &i64Create a temporary directory. Returns handle.
tmp_path
fn tmp_path(handle: &i64, dst: &i8) -> i64Copy path to dst buffer. Returns length.
tmp_fd
fn tmp_fd(handle: &i64) -> i64Get file descriptor.
tmp_write
fn tmp_write(handle: &i64, data: &i8, len: i64) -> i64Write bytes to temp file.
tmp_read
fn tmp_read(handle: &i64, dst: &i8, max: i64) -> i64Read bytes from temp file (seeks to start first).
tmp_close
fn tmp_close(handle: &i64)Close the file descriptor.
tmp_remove
fn tmp_remove(handle: &i64)Delete the temp file or directory.