int fwscanf(FILE* qpStream, const wchar_t* kwpFormatString, ...);
#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 string from the file
wchar_t waReadString[100];
int iReturn = fwscanf(qpFile, L"%s", waReadString);
// Check whether the read was successful.
if (iReturn == WEOF) {
cout << "Read error!" << endl;
} else {
wcout << "Read String = " << waReadString << endl;
}
fclose(qpFile);
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.