FReadFmt
- Macro
- August 22, 2025
Table of Contents
FReadFmt
FReadFmt
Description
Read formatted data from a file stream. This is a macro wrapper around FReadFmtInternal.
Parameters
Name | Direction | Description |
---|---|---|
stream | in | Pointer to the FILE stream to read from. |
fmtstr | in | Format string to be used for reading. This must exactly describe the expected input format in the stream. argument should be a modifiable l-value wrapped with &variable . |
Success
Attempts to match fmtstr
with the stream of characters in stream
and reads values into the provided arguments wrapped with ``.
Failure
Failure occurs within FReadFmtInternal
. Refer to its documentation for details on failure behavior (logs error message and returns, may rollback read data, or abort in unexpected situations).
Usage example (Cross-references)
- In
Io.h:488
:
/// TAGS: Macro, Convenience, Stdin, I/O
///
#define ReadFmt(...) FReadFmt(stdin, __VA_ARGS__)
// not for direct use
- In
ElfInfo.c:346
:
ElfHeader64 eh = {0};
FReadFmt(elf, FMT_ELF_META, eh.meta.class, eh.meta.encoding, eh.meta.version, eh.meta.os_abi, eh.meta.abi_version);
// technically padding here but we can skip it
- In
ElfInfo.c:358
:
}
FReadFmt(
elf,
eh.meta.encoding == ELF_ENCODING_LSB ? FMT_ELF_HEADER_64_LE : FMT_ELF_HEADER_64_BE,