get open modes for file c++ code example
Example 1: opening file in c++
/ fstream::open / fstream::close
#include <fstream> // std::fstream
int main () {
std::fstream fs;
fs.open ("test.txt", std::fstream::in | std::fstream::out | std::fstream::app);
fs << " more lorem ipsum";
fs.close();
return 0;
}
Example 2: fstream read write mode
stream file;
file.open(fileName,ios::in | ios::out);