Skip to content

FWriteFmt

FWriteFmt

Description

Write formatted output to a file stream. This macro internally uses StrWriteFmtInternal to format the string and then writes it to the stream.

Parameters

Name Direction Description
stream in Pointer to the FILE stream to write to.
fmtstr in Format string with {} placeholders. should be wrapped with variable.

Success

Placeholders in fmtstr are replaced by the passed arguments, and the resulting formatted string is written to the specified stream.

Failure

Failure might occur during memory allocation for the temporary string or during the write operation to the stream (handled by fputs). Errors from StrWriteFmtInternal (logging messages) might also occur.

Usage example (Cross-references)

Usage examples (Cross-references)
    
        // Print the log prefix to stderr
        FWriteFmt(stderror, "[{}] [{}:{}] ", msg_type, tag, line);
    
        fputs(msg, stderror);
    /// TAGS: Macro, Convenience, Stdout, I/O
    ///
    #define WriteFmt(...) FWriteFmt(stdout, __VA_ARGS__)
    
    ///
Last updated on