Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // using ofstream constructors.
- #include <iostream>
- #include <fstream>
- std::ofstream outfile ("test.txt");
- outfile << "my text here!" << std::endl;
- outfile.close();
- #include <iostream>
- #include <fstream>
- int main() {
- std::ofstream o("Hello.txt");
- o << "Hello, Worldn" << std::endl;
- return 0;
- }
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- string filename = "/tmp/filename.txt";
- int main() {
- std::ofstream o(filename.c_str());
- o << "Hello, Worldn" << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement