文件拷贝 (Copy content from file1 to file2)
来源:互联网 发布:sas编程技术教程 编辑:程序博客网 时间:2024/06/05 20:28
通过C程序将一个文件内容拷贝到另外一个文件,代码,把程序一拷进CSDN编辑器就变得缩进没了,真是郁闷:
/*Global inclusions*/
#include<stdio.h>
#include<stdafx.h>
#include<string.h>
#include<conio.h>
/*Gloabal function definition*/
void CharReadWrite(FILE *fl1, FILE *fl2);
/*Main function*/
void main()
{
/*Define two file pointers*/
FILE *fl1, *fl2;
/*Initialize files router*/
char namefl1[] ="C:\\Documents\\Demo1.txt";
char namefl2[] ="C:\\Documents\\Demo2.txt";
/*Open file1 in reading modern*/
fl1 = fopen( namefl1,"r" );
/*Open file2 in writing modern*/
fl2 = fopen( namefl2,"w" );
/*Make sure above two steps perform correctly*/
if (fl1 == NULL)
{
if(fl2 == NULL)
{
printf("Can't open file %s.\n", namefl2);
}
else
{
printf("Can't open file %s.\n", namefl1);
}
}
else
{
/*Copy content*/
CharReadWrite(fl1, fl2);
/*Close file stream*/
fclose(fl1);
fclose(fl2);
getch();
}
}
void CharReadWrite(FILE *fl1, FILE *fl2)
{
int c;
while((c = fgetc(fl1)) != EOF)
{
fputc(c, fl2);
putchar(c);
}
}
- 文件拷贝 (Copy content from file1 to file2)
- linux ln file1 file2
- 读文件file1.txt的内容到file2.txt
- 两个文件file1 file2, file1按递增顺序, 不小心将空格去掉了, 需还原
- awk file1 file2问题总结
- LINUX 下diff 比较文件时出现错误:Binary files file1.txt and file2.txt differ
- diff -y --suppress-common-lines file1 file2
- 用C语言实现类似“cp file1 file2”命令
- Qt拷贝文件、文件夹(QFile::copy)
- shellJ脚本--拷贝文件(copy)
- Qt拷贝文件、文件夹(QFile::copy)
- Qt拷贝文件、文件夹(QFile::copy)
- Qt拷贝文件、文件夹(QFile::copy)
- Linux系统中,有两个文件file1和file2,每个文件的每一行都是#UUID,其中的每一UUID表示一个号。要找出在file1中有而在file2中没有的UUID,使用cat,sort,uniq三个命令如何实现
- 随机生成个数50和20的字符串分别存在file1,file2中并将在file1中出现且不在file2中的字符存在flie3中
- android 数据存储之File2(文件存储数据)
- file2
- file1
- ftpj4图解
- SQL中获取一个关键字在某个字符串出现次数
- 回调函数及使用方法
- DWZ框架常见问题及解决
- android java Socket多文件发送
- 文件拷贝 (Copy content from file1 to file2)
- extjs的combobox传值问题
- 添加/sbin到环境变量
- android ftp客户端
- struts2文件上传
- Linux管理员使用OpenSSL测试服务器技巧
- ucenter整合第三方应用mlecms(1)
- extern,define,typedef
- Sql Server 2005数据库备份还原后出现“受限制用户”