FReadFmtInternal
- Function
- August 22, 2025
Table of Contents
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)
- In
Io.h:358
:
TypeSpecificIO *argv_##__LINE__ = &(varr)[0]; \
size argc_##__LINE__ = sizeof(varr) / sizeof(TypeSpecificIO) - 1; \
FReadFmtInternal((file), (fmtstr), argv_##__LINE__, argc_##__LINE__); \
} while (0)
- In
Io.c:592
:
#endif
void FReadFmtInternal(FILE* file, const char* fmtstr, TypeSpecificIO* argv, size argc) {
if (!file || !fmtstr) {
LOG_FATAL("Invalid arguments");