This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<fstream> | |
int main() | |
{ | |
std::ofstream file_txt("file.txt"); | |
file_txt << "hello world " << std::endl; | |
file_txt.close(); | |
return 0; | |
} |
To build:
$: clang++ ofstream.cpp
Run it:
$: ./a.out
Read the file:
$: cat file.txt
No comments:
Post a Comment