close a filestream c 2b 2b

Solutions on MaxInterview for close a filestream c 2b 2b by the best coders in the world

showing results for - "close a filestream c 2b 2b"
Corina
14 May 2016
1// fstream::open / fstream::close
2#include <fstream>      // std::fstream
3
4int main () {
5
6  // instantiating the file stream
7  std::fstream fs;
8  
9  // opening the file with the fstream
10  fs.open ("test.txt", std::fstream::in | std::fstream::out | std::fstream::app);
11
12  fs << " more lorem ipsum";
13
14  // closing the file
15  fs.close();
16
17  return 0;
18}