devela::sys::os::linux::io

Function linux_prompt

Source
pub fn linux_prompt<'input, const CAP: usize>(
    text: &str,
    buffer: &'input mut [u8; CAP],
) -> &'input str 
Available on crate features unsafe_syscall and linux only.
Expand description

Prompts the user for a string from stdin, backed by a buffer.

§Examples

use devela::linux_prompt;

let mut name_buffer = [0_u8; 32];
let name: &str = linux_prompt::<32>("Enter your name: ", &mut name_buffer);

§Error Handling

If the write fails, it prints an error message and exits with status code 10. If the read fails, it prints an error message and exits with status code 11.