wint_t getwc(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) {
cout << "Could not open the file!" << endl;
return 1;
}
// Read a char from the file
int iReturn = getwc(qpFile);
// Check whether the read was successful.
if (iReturn == WEOF) {
cout << "Read error!" << endl;
} else {
wcout << "Read char = " << (wchar_t)iReturn << endl;
}
fclose(qpFile);
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.