int fclose(FILE* qpStream);
#include <cstdio>
int main()
{
FILE* qpFile;
char* cpFileName = "XoaX.txt";
qpFile = fopen(cpFileName, "r" );
// Verify that we opened the file.
if (qpFile) {
printf("Opened the file %s for reading \n", cpFileName);
} else {
printf("Could not open %s for reading \n", cpFileName);
return 1;
}
// Now close the file and verify that it closed.
int iCloseResult = fclose(qpFile);
if (iCloseResult == 0) {
printf("Closed the file %s\n", cpFileName);
} else {
printf("Could not close the file %s\n", cpFileName);
}
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.