转:(\n\r)和换行(\r)的区别
freertos吧
全部回复
仅看楼主
level 11
huarkkk 楼主
这个说得比较清楚。
http://blog.csdn.net/xiaofei2010/article/details/8458605
windows下的点一下回车,效果是:回车换行,就是\r\n
unix系统下的回车一下就是一个\n
给出如下代码:
#include <iostream>
using namespace std;
int main()
{
cout << "this is the first line\n";
cout << "this is the second line\r";
cout << "this is the third line\n";
cout << "this is the fouth line\r";
cout << "this is the fifth line\n";
cout << "end" ;
return 0;
}
运行结果如下:
回车换行(\n\r):每次光标移到下一行的行首位置处;
换行(\r):每次光标移到本行的行首位置处。
2016年01月05日 08点01分 1
1