Hi,
I just found that if I use fstream to write to a file under nonexistent directory, it will not report any error or do any thing you want during execution. For example, where there is no directory called "tmp" under current directory,
How to specify in code to create a directory if it is not existent ? Thanks!Code:#include <fstream> using namespace std; int main() { ofstream fout( "./tmp/results.txt", ios::app ); fout << 2 <<endl; return 0; }