Does anyone know how it is possible to use read() and lseek() in a c program to test the end of a file without changing the current position in a file? I thought that you couldn't use lseek() without changing the file offset? Thanks for your help.
I'm not sure I understand. I thought testing for EOF meant checking if the file pointer was at the end of the file, and didn't involve moving it at all.
Zhuge - i agree but I was asked to implement a function using read() and lseek() that tests the end of a file without changing the current position in a file. I know I can save the current position and then use lseek() to find out what byte the EOF and then change it back, so i think this is all I need to do but if you have any other suggestions I'd appreciate it.