0
Whats the problem here in writing into a file?
int main() { string path = "\\storage\\emulated\\0\\Download\\text.txt"; ofstream file( path ); if (file.is_open()) { file << "here is the message"; cout<< "message was written"; } if (file.is_open()) file.close(); } It prints out "message was written" but there is not a txt file in the path. 1) Is the path wrong? If yes how can I find the correct path for the folder I want the file to be created at? 2) Does sololearn's playground not support file operations?
1 Antwort
+ 2
I tested this and found no problem. The program is creating the file and writing into it. If you add code to open the same file and read it, then you will get "here is the message".
If you are hoping to see the file appear on your local device when using SoloLearn's Playground then you will be disappointed. The program runs on SoloLearn's server, so the file gets created their machine; not yours.