Skip to content

FileStdin

Description

Standard input / output / error accessors. Wrapping the well-known fds 0/1/2 on POSIX, the GetStdHandle() values on Windows.

Success

Returns a borrowed File (owns = false) referring to the corresponding standard stream.

Failure

Function cannot fail.

Usage example (Cross-references)

Usage examples (Cross-references)
    #define ReadFmt(...)                                                                                                   \
        do {                                                                                                               \
            File UNPL(in) = FileStdin();                                                                                   \
            FReadFmt(&UNPL(in), __VA_ARGS__);                                                                              \
        } while (0)
    }
    
    File FileStdin(void) {
    #if PLATFORM_WINDOWS
        File f = {.handle = GetStdHandle(STD_INPUT_HANDLE), .owns = false};
Last updated on