小编Ayu*_*ush的帖子

C中perror函数两个输出执行顺序的差异

删除“\n”时相同代码上的输出序列之间的差异

#include<stdio.h>
#include<errno.h>
#include<string.h>


int main()
{
FILE * fp;
fp = fopen("GeeksForGeeks", "/root/C");
printf("Value of error no : %d\n", errno);
printf("The error message is : %s\n", strerror(errno));
perror("Message from perror.");
return 0;
}
Run Code Online (Sandbox Code Playgroud)

这是我的代码,但是当我删除“\n”时,perror 的执行顺序发生了变化。谁能解释为什么?

c errno execution

1
推荐指数
1
解决办法
69
查看次数

标签 统计

c ×1

errno ×1

execution ×1