64,654
社区成员
发帖
与我相关
我的任务
分享
#include "stdafx.h"
#include "stdio.h"
#include <iostream>
#include "windows.h"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
FILE *fp;
fp = fopen("c:\\data.txt", "rb");
if(fp!=NULL)
{
fseek(fp,0,SEEK_END);
int nlen = ftell(fp);
fseek(fp,0,SEEK_SET);
char* p = new char[nlen+1];
fread(p,sizeof(char),nlen,fp);
fclose(fp);
p[nlen]=0;
printf("%s",p);
char c ='\t';
char s =' ';
char r ='\r';
char n ='\n';
FILE* fpw = fopen("c:\\data1.txt","wt");
if (fpw)
{
fwrite(p,sizeof(char),nlen,fpw);
fclose(fpw);
}
system("pause");
}
system("pause");
return 0;
}
aa 12 bb dd 13 14 32
cc dd ff9 10
aa, bbc ddd
dda
aa