borland c++文本换行问题
#include <conio.h>
#include <stdio.h>
#include <dos.h>
#include <string.h>
代码如下:
#include <stdlib.h>
#include <io.h>
#include <fcntl.h>
void main()
{
int fp,n;
const int buffsize=1024;
char buff[buffsize];
fp = open( "d:\\1.txt ", O_RDONLY);
if((n = read(fp, buff, buffsize)) > 0)
printf( "%s\n ", buff);
close(fp);
}
我用超级终端传了一个文件1.txt 到另外一台机器上,保存在d:\\1.txt,然后运行上面的程序.
1.txt的内容如下:
1hkhjluopjklk4
111
d:\\1.txt的内容如下:
1hkhjluopjklk4111
程序输出为:
1hkhjluopjklk4111
这是为什么啊?
[解决办法]
\r\n
[解决办法]
printf( "%s\n\r ", buff);