7,540
社区成员
发帖
与我相关
我的任务
分享
#include "stdafx.h"
#include <fstream>
#include <iomanip>
#include <iostream>
using namespace std;
void main(int count,char* paths[])
{
fstream fin(paths[1],ios_base::binary|ios_base::in);
fstream fout(paths[2],ios_base::binary|ios_base::out);
int len = 8;
char *buf = NULL;
buf = (char *)malloc(len);
memset(buf,0,sizeof(buf));
while(!fin.eof())
{
fin.read(buf,len);
fout.write(buf,len);
}
fin.close();
fout.close();
free(buf);
}
FILE *fPtr;
fPtr = fopen(a.txt,"r");//開啟檔案a.txt
while(!feof(fPtr))
{
fscanf(fPtr,"%d %d\n",&Num1,&Num2);//讀取資料
//可在這裡加你要做的判斷
}
fclose(fPtr);