@asics
Freelance
2853 / 1788 / 144
Регистрация: 09.09.2010
Сообщений: 3,841
|
24.05.2011, 14:09
|
|
Еще вариант: C++ | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| #include <iostream>
#include <fstream>
#include <string>
#include <iterator>
void cp(std::ifstream &f, std::ofstream &t){
std::string s( (std::istreambuf_iterator<char>(f)),
std::istreambuf_iterator<char>() );
t << s;
}
int main(){
std::ifstream ifs("1.txt");//From
std::ofstream ofs("2.txt");//To
if(!ifs || !ofs){
std::cerr << "ERROR";
return 1;
}
cp(ifs, ofs);
return 0;
} |
|
2
|