首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

borland c++文本换行有关问题

2012-02-25 
borland c++文本换行问题#includeconio.h#includestdio.h#includedos.h#includestring.h代码如下:

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的内容如下:
1hkhjluopjklk4▊111  

程序输出为:
1hkhjluopjklk4111  

这是为什么啊?

[解决办法]
\r\n
[解决办法]
printf( "%s\n\r ", buff);

热点排行