windows 系统的文件换行符不是rn 吗,为什么下面的 c 程序的输出结果不太一样

20次阅读

共计 171 个字符,预计需要花费 1 分钟才能阅读完成。

c 程序:

#include 
int main()
{FILE *fd = fopen("tmpfile.txt", "r");
    

    char c;
    while ((c = getc(fd)) != EOF)
    {printf("%d,", c);
    }
}

tmpfile.txt 内容:
1
2

程序输出结果:
49, 10, 50,

程序不应该是输出:
49, 13, 10, 50,

吗?

补充:在 win11 下执行

正文完
 0