typedef basic_fstream<wchar_t, char_traits<wchar_t> > wfstream;
#include <fstream>
#include <iostream> #include <fstream> int main() { using namespace std; wfstream qXoaXFile; // Open a Unicode text file for reading and writing. qXoaXFile.open("XoaX.txt", ios_base::out | ios_base::in | ios_base::trunc); if (qXoaXFile.is_open()) { // Write the string into the file qXoaXFile << L"XoaX.net" << endl; // Set the reading location to the beginning of the file qXoaXFile.seekg(0); // Read the file back out wcout << L"Read from file: " << qXoaXFile.rdbuf() << endl; qXoaXFile.close(); } 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.