如果系统调用函数失败,我们通常使用perror输出错误消息。我想使用fprintf输出错误字符串。我如何做这样的事情:
fprintf(stderr, perror output string here);发布于 2011-03-30 15:20:52
#include <errno.h>
fprintf(stderr, "%s\n", strerror(errno));注意: strerror不会将\n应用到消息的末尾
https://stackoverflow.com/questions/5483120
复制相似问题