+ 1
What about writing to files?
I need to write to a file on my harddisk. How can I do this with C++?
2 Respostas
+ 2
#include <fstream>
header file.
+ 2
a example of how to write in a file:
#include <iostream>
#include <fstream>
using namespace std;
int main(){
fstream archive;
archive.open("anytext.txt");
if(archive.fail()){
cout << "error opening file\n";
return 1;
}
string x = "abcde";
archive << x;
archive.close();
return 0;
}