printf() 是否在失败时设置 errno?

Does printf() set errno upon failure?

printf() 是否将 errno 设置为适当的值,除了在失败时仅返回“a -ve 值”?

我似乎无法在 Google 上找到有关此内容的手册页。

如果重复,请关闭此问题。 Link答案。

是的,在任何 POSIX 系统上,但不一定在任何 ISO C 实现中。

来自https://pubs.opengroup.org/onlinepubs/9699919799/functions/fprintf.html

If an output error was encountered, these functions shall return a negative value and set errno to indicate the error.

粗体部分标记为对 ISO C 的扩展。