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:

Configuring TUN/TAP virtual network interface for use with QEMU on Xubuntu 24.04

Configuring TUN/TAP virtual network interface for use with QEMU on Xubuntu 24.04 I am planning to run qemu-system-ppc to play around QEMU ...