hi there, if i want to prompt user to locate the file and open, how would i do it?
for example:
#include <iostream>
#include <fstream>
using namespace std;
int main () {
ofstream myfile;
myfile.open ("example.txt") ;
myfile << "Writing this to a file.\n";
myfile.close();
return 0;
}
if i want to prompt user to open "example.tx t" not open within the code, how would i code it so that when this programe is run, the 1st thing will ask for user to select file location and open, then continue the process such as writing "Writing this to a file". thanks
for example:
#include <iostream>
#include <fstream>
using namespace std;
int main () {
ofstream myfile;
myfile.open ("example.txt") ;
myfile << "Writing this to a file.\n";
myfile.close();
return 0;
}
if i want to prompt user to open "example.tx t" not open within the code, how would i code it so that when this programe is run, the 1st thing will ask for user to select file location and open, then continue the process such as writing "Writing this to a file". thanks
Comment