Skip to content
FReadFmtInternal

FReadFmtInternal

FReadFmtInternal

Description

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

Parameters

Name Direction Description
stream in FILE* we’re reading from.
fmtstr in Format string to be used for reading. This must exactly describe input format.
argv in Array of TypeSpecificIO structures describing where to read for each corresponding placeholder.
argc in Number 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)

Usage examples (Cross-references)
    }
    
    void FReadFmtInternal(FILE *file, const char *fmtstr, TypeSpecificIO *argv, u64 argc) {
        if (!file || !fmtstr) {
            LOG_FATAL("Invalid arguments");
            TypeSpecificIO *argv_ = &(varr)[0];                                                                            \
            u64             argc_ = sizeof(varr) / sizeof(TypeSpecificIO) - 1;                                             \
            FReadFmtInternal((file), (fmtstr), argv_, argc_);                                                              \
        } while (0)
Last updated on