wint_t fgetwc(FILE* qpStream);
#include <iostream> #include <cwchar> int main() { using namespace std; char* cpFileName = "XoaX.txt"; FILE* qpFile = fopen(cpFileName, "r"); // Check that the file could be opened if (!qpFile) { wcout << L"Could not open the file" << endl; return 1; } // Read the first char of the file. wchar_t wFirstChar = fgetwc(qpFile); if (wFirstChar != WEOF) { // Output it as a char. wcout << L"Char read: " << wFirstChar << endl; } else { wcout << L"Read Error" << endl; } fclose(qpFile); return 0; }
© 20072024 XoaX.net LLC. All rights reserved.