C++ defers to C and C does not require or mention errno
in the description of sprintf()
and family (although for certain format specifiers, these functions are defined to call mbrtowc()
, which may set EILSEQ
in errno
)
POSIX requires that errno is set:
If an output error was encountered, these functions shall return a negative value and set
errno
to indicate the error.
EILSEQ, EINVAL, EBADF, ENOMEM, EOVERFLOW are mentioned explicitly: http://pubs.opengroup.org/onlinepubs/9699919799/functions/fprintf.html