template <class C, class T = char_traits<C> > basic_fstream<C,T>::basic_fstream();
#include <fstream>
explicit basic_fstream<C,T>::basic_fstream(const char* kcpFilename, ios_base::openmode qOpenMode = ios_base::in | ios_base::out);
#include <iostream> #include <fstream> int main() { using namespace std; basic_fstream<char> qXoaXFile; // Open an ASCII 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 << "XoaX.net" << endl; // Set the reading location to the beginning of the file qXoaXFile.seekg(0); // Read the file back out cout << "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.