typedef basic_filebuf<wchar_t, char_traits<wchar_t> > wfilebuf;
#include <fstream>
#include <iostream>
#include <fstream>
int main() {
using namespace std;
wfilebuf qXoaXFile;
// Open a Unicode 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(L"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.