FReadFmt

Table of Contents

FReadFmt

Description

Read formatted data from a file stream. This is a macro wrapper around FReadFmtInternal.

Parameters

NameDirectionDescription
streaminPointer to the FILE stream to read from.
fmtstrinFormat 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)

    /// TAGS: Macro, Convenience, Stdin, I/O
    ///
    #define ReadFmt(...) FReadFmt(stdin, __VA_ARGS__)
    
    // not for direct use
    
    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
    }
    
    FReadFmt(
    elf,
    eh.meta.encoding == ELF_ENCODING_LSB ? FMT_ELF_HEADER_64_LE : FMT_ELF_HEADER_64_BE,

Share :

Related Posts

FReadFmtInternal

FReadFmtInternal Description Read formatted data from file streams (stdin, or other file)

Read More

JW_BOOL_KV

JW_BOOL_KV Description Write a key and boolean value into a JSON object.

Read More

StrReadFmt

StrReadFmt Description Parse input string according to format string with rust-style placeholders, extracting values into provided arguments. This is a macro wrapper around StrReadFmtInternal.

Read More