basic_filebuf<C,T>* basic_filebuf<C,T>::open(const char* kcpFilename, ios_base::openmode qOpenMode);
#include <fstream>
#include <iostream>
#include <fstream>
int main() {
using namespace std;
basic_filebuf<char> qXoaXFile;
// Open an ASCII text file. Create a new file if it does not exist.
qXoaXFile.open("XoaX.txt", ios_base::out | ios_base::trunc);
if (qXoaXFile.is_open()) {
// Write the string into the file
qXoaXFile.sputn("XoaX.net", 8);
qXoaXFile.close();
cout << "Wrote \"XoaX.net\" to the file \"XoaX.txt\"." << endl;
} else {
cout << "\"XoaX.txt\" failed to open" << endl;
return -1;
}
// Keep the window open
cin.get();
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.