int fgetc(FILE* qpStream);
#include <cstdio> int main() { char* cpFileName = "XoaX.txt"; FILE* qpFile = fopen(cpFileName, "r" ); // Check that the file could be opened if (!qpFile) { printf("Could not open %s for reading \n", cpFileName); return 1; } // Read the first byte of the file. int iFirstChar = fgetc(qpFile); if (iFirstChar != EOF) { // Output it as a char. printf("Byte Read: %c\n", iFirstChar); } else { printf("Read Error"); } fclose(qpFile); return 0; }
© 20072024 XoaX.net LLC. All rights reserved.