long ftell(FILE* qpStream);
#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;
}
// Set the file pointer to two from the end
int iRet = fseek(qpFile, 2, SEEK_END);
// Find the position of the pointer in the file.
long lPos = ftell(qpFile);
if (lPos != EOF) {
printf("File pointer is at %i\n", lPos);
}
fclose(qpFile);
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.