chsvlib
chsv helper source code

◆ fPrintfA_s()

int Chusov::String::fPrintfA_s ( ::FILE *restrict  stream,
const char *restrict  pszFormat,
  ... 
)
noexcept

The function behaves identically to fPrintfA but with some security enhancements.

Parameters
[in]streamis an output file stream to write to.
[in]pszFormatis a pointer to a zero terminated string defining how to interpret data, passed as additional parameters, during the construction of the output. See PrintfA_s for the definition of the format lexemes.
[in]...constitute an optional set of additional parameters to build the formatted output according to pszFormat.
Returns
On success the function returns a number of bytes of the output not counting the terminating zero. If an output, encoding or runtime constraint violation error occurs the function returns a negative value.

The function behaves identically to fPrintfA except for the following explicit runtime constraints: 1) Neither stream not pszFormat is a NULL pointer. 2) The 'n' format type specifier is not allowed (modified or not by additional flags, width, precision, size). 3) Any pointer corresponding to the 's' or 'S' format type specifier must not be NULL.

If any of this constraints are violated the function will generate assertion and, if continue of execution is allowed, fail setting errno to EINVAL.

The function implements security enhancements for the fPrintfA function just like fprintf_s function, defined in the ISO/IEC TR 24731-1 standard, provides the same enhancements for the C99 fprintf function.

See also
PrintfA_s;
fPrintfA;
fPrintfW_s.