Website Summary Files Commits Branches @commit @diff @stats
path: root / Week06 / Exercise03.cpp
blob: 5b26705c89f2d00a2ccd14170cd5cde5d283a8f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
#include <fstream>

int main() {
	// Във файловите системи, имената на файлове са с ограничена дължина,
	// така че и ние да работим с ограничена дължина е коректно
	char fileName[1024];
	std::cin.getline(fileName, sizeof(fileName) / sizeof(*fileName));

	std::ofstream outFile(fileName);

	if (!outFile.is_open()) {
		std::cout << "Couldn't open file!" << std::endl;
	}
	else {
		for (char curr = std::cin.get(); curr != '@'; curr = std::cin.get()) {
			outFile.put(curr);
		}
	}

	return 0;
}