FReadFmtInternal

Table of Contents

FReadFmtInternal

Description

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

Parameters

NameDirectionDescription
streaminFILE* we’re reading from.
fmtstrinFormat string to be used for reading. This must exactly describe input format.
argvinArray of TypeSpecificIO structures describing where to read for each corresponding placeholder.
argcinNumber of TypeSpecificIO values in array.

Success

Compares fmtstr with stream of characters in stream and reads values at placeholders. A valid value will be stored in . arg provided.

Failure

Logs out error message and returns. If rollback is possible, then un-reads all the read data. Restoring original state. Method can also abort if something really unexpected is encountered. Returns NULL if format string does not match with input stream.

Usage example (Cross-references)

    TypeSpecificIO *argv_##__LINE__ = &(varr)[0];                                                                  \
    size            argc_##__LINE__ = sizeof(varr) / sizeof(TypeSpecificIO) - 1;                                   \
    FReadFmtInternal((file), (fmtstr), argv_##__LINE__, argc_##__LINE__);                                          \
    } while (0)
    #endif
    
    void FReadFmtInternal(FILE* file, const char* fmtstr, TypeSpecificIO* argv, size argc) {
    if (!file || !fmtstr) {
    LOG_FATAL("Invalid arguments");

Share :

Related Posts

StrWriteFmtInternal

StrWriteFmtInternal Description Print out a formatted string with rust-style placeholders to given string o.

Read More

SysGetFileSize

SysGetFileSize Description Get size of file without opening it.

Read More

void

void Description Type-specific write callback signature

Read More