复制文件中的内容到另一个文件
2012-10-24 20:44
218 查看
// C String.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include<iostream> #include<fstream> #include<cstring> int main(int argc, char* argv[]) { using namespace std; char arrstr[1024] ; ifstream in; ofstream out; in.open ("studentInfo.txt"); out.open ("studentInfo1.txt"); if(in.fail()) { cout<<"open file failed"; exit(1); } if(out.fail()) { cout<<"open file failed"; exit(1); } int i = 0; while( !in.eof() ) { in.getline(arrstr,1024); out<<arrstr<<endl; i++; } cout<<i<<endl; return 0; }
最后输出读取的行数
相关文章推荐
- java 从一个文件中读取内容 复制到 另一个文件中
- 从控制台输入test文件并把内容复制到另一个test2文件
- c语言初步经典题16---将一个文件的内容复制到另一个文件里面
- Python--复制某个文件的内容到另一个文件中
- 用文件方式复制内容到另一个文件
- (六)两种方式将一个文件的内容复制到另一个文件(第二种方式效率更高,第一种一个字符一个字符的读写,第二种一个数组一个数组的读写)
- java IO编程——复制一个文件中的内容到另一个文件
- C程序 复制文件内容到另一个文件
- 系统调用,将一个文件复=中的内容复制到另一个文件中去
- 一个文件的内容复制到另一个文件中.
- linux下复制一个文件的内容到另一个文件
- 打开一个文件并把他的内容复制给另一个文件
- java读取文件夹中文件,并复制内容到另一个文件中
- 文件夹下的文件复制到另一个文件夹下
- // 复制源文件内容到目标文件
- 复制图纸空间的视口到另一个dwg文件中2(wblockcloneobjects方法)
- Linux 将文件夹下的所有文件复制到另一个文件里
- linux上复制行到另一个文件
- 文件操作(判断状态、删除、新建、复制、清空文件内容、获取文件长度)
- 把一个file对象的内容带上行号复制到另一个file对象(java)