- #include <iostream>
- #include <fstream>
- int main()
- {
- std::fstream out("test.txt", std::ios::out | std::ios::trunc | std::ios::binary);
- out << "hello world";
- out.flush();
- std::fstream in("test.txt", std::ios::in | std::ios::binary);
- std::cout << in.rdbuf();
- return 0;
- }