equal
deleted
inserted
replaced
|
1 /** |
|
2 * Kopierprogramm für Dateien in C++ |
|
3 * Copyright (C) 2008 Markus Bröker |
|
4 */ |
|
5 |
|
6 #include <iostream> |
|
7 #include <fstream> |
|
8 |
|
9 int main(int argc, char **argv) |
|
10 { |
|
11 std::ifstream in; |
|
12 std::ofstream out; |
|
13 |
|
14 char c; |
|
15 |
|
16 if ( argc != 3 ) { |
|
17 std::cout << "Benutzung: " << argv[0] << " <datei> <datei>" << std::endl; |
|
18 return EXIT_SUCCESS; |
|
19 } |
|
20 |
|
21 in.open(argv[1], std::ios::binary); |
|
22 if ( !in ) { |
|
23 std::cerr << "Fehler: Kann Datei " << argv[1] << " nicht lesen!" << std::endl; |
|
24 } |
|
25 |
|
26 out.open(argv[2]); |
|
27 if ( !out ) { |
|
28 std::cerr << "Fehler: Kann Datei " << argv[2] << " nicht beschreiben!" << std::endl; |
|
29 } |
|
30 |
|
31 while ( in.get(c) ) { |
|
32 out << c; |
|
33 } |
|
34 |
|
35 in.close(); |
|
36 out.close(); |
|
37 |
|
38 return EXIT_SUCCESS; |
|
39 } |