int fscanf(FILE* qpStream, const char* kcpFormatString, ...);
#include <cstdio>
int main()
{
char* cpFileName = "XoaX.txt";
// Open an ASCII text file for reading.
FILE* qpFile = fopen(cpFileName, "r" );
// Check that the file was opened successfully.
if (!qpFile) {
printf("Could not open %s for reading \n", cpFileName);
return 1;
}
char cBuffer[50];
// Read in the first and only string of the file.
int iRet = fscanf(qpFile, "%s", cBuffer);
if (iRet != EOF) {
printf("Read in: %s\n", cBuffer);
}
fclose(qpFile);
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.