blob: 984a10b0d339b6a675baf13037fb27cbef63fd82 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include <iostream> // cin, cout
#include <fstream> // ifstream, ofstream
const int LINE_BUFFER_SIZE = 1024;
const int FILEPATH_SIZE = 4096;
int main() {
char inName[FILEPATH_SIZE], outName[FILEPATH_SIZE];
std::cin >> inName >> outName;
std::ifstream inFile(inName);
if (!inFile.is_open()) {
std::cout << "Error: File could not be opened!" << std::endl;
return -1;
}
std::ofstream outFile(outName);
if (!outFile.is_open()) {
std::cout << "Error: File could not be opened!" << std::endl;
return -1;
}
char buffer[LINE_BUFFER_SIZE];
while (!inFile.eof()) {
inFile.getline(buffer, LINE_BUFFER_SIZE);
outFile << buffer;
if (!inFile.eof()) outFile << std::endl;
}
inFile.close();
outFile.close();
}
|