void rewind(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 the file %s\n", cpFileName);
return 1;
}
// Set the file pointer position to 4
fseek(qpFile, 4, SEEK_SET);
long lPos = ftell(qpFile);
printf("File pointer is at %d\n", lPos);
// Set the file pointer position back to 0
rewind(qpFile);
lPos = ftell(qpFile);
printf("File pointer is at %d\n", lPos);
fclose(qpFile);
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.