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

c语复制资料

2012-08-28 
c语复制文件//// Name: H

c语复制文件

//============================================================================// Name        : HelloWorld.cpp// Author      : liuqing// Version     :// Copyright   : Your copyright notice// Description : C语言操作文件//复制文件//============================================================================#include <iostream>#include <stdio.h>#include <stdlib.h>#include <dirent.h>using namespace std;int main() {//定义文件指针FILE *fp,*toFp;//定义输出字符cout << "Reading file...." << endl;//打开文件if ( ((fp = fopen("f:\\aa.txt","rb")) == NULL)){cout << "error open file f:\\aa.txt";}else{if ( (toFp = fopen("F:\\bbmus\\usb.txt","ba+")) == NULL ){cout << "Write error" << endl;}while (!feof(fp)){cout << "reading file!";char ch = fgetc(fp);if (ch != EOF){    fputc(ch,toFp);}}}fclose(fp);fclose(toFp);//关闭文件return 0;}

?

热点排行