I have this code that writes successfully a file:
ofstream outfile (path); outfile.write(buffer,size); outfile.flush(); outfile.close();
Try this:
ofstream outfile; string createFile = ""; string path="/FULL_PATH"; createFile = path.as() + "/" + "SAMPLE_FILENAME" + ".txt"; outfile.open(createFile.c_str()); outfile.close(); //It works like a charm.