Wednesday, January 29, 2020

CPP: Write to a file using ofstream

#include<iostream>
#include<fstream>
int main()
{
std::ofstream file_txt("file.txt");
file_txt << "hello world " << std::endl;
file_txt.close();
return 0;
}
view raw ofstream.cpp hosted with ❤ by GitHub


To build:
$: clang++ ofstream.cpp

Run it:
$: ./a.out

Read the file:
$: cat file.txt

No comments:

Fedora install screen chronicle

Fedora install screen chronicle Below are links to Fedora installation screens. It is interesting to see how it has evolved over time. Fe...