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

int main() {
	std::ofstream outFile("HelloWorld.txt", std::ios::trunc);

	if (!outFile.is_open()) {
		std::cout << "Couldn't open file!" << std::endl;
	}
	else {
		const char HELLO_WORLD[] = "Hello World!";
		outFile.write(HELLO_WORLD, sizeof(HELLO_WORLD) / sizeof(*HELLO_WORLD));
	}

	return 0;
}