Hi there, I tried to open and write to files but I can't get it to work. I tried the code below in Coderunner app and in Xcode. I was expecting text editor to open a file, write to it, and save it somewhere. Program runs but nothing happens, and if I comment out myfile.close() I don't see and open .txt file anywhere. The solution is probably very simple, thanks in advance for help.
1 2 3 4 5 6 7 8 9 10 11
#include <iostream>
#include <fstream>
usingnamespace std;
int main () {
ofstream myfile;
myfile.open ("example.txt");
myfile << "Writing this to a file.\n";
myfile.close();
return 0;
}