Get the length of the file, set the file pointer to the end of the file (length) - the size of the buffer, then move the file pointer backwards from there in a loop...
i.e.
1) file pointer position = length of file - sizeof(buffer)
2) read data into buffer
3) set file pointer position = file pointer position - sizeof(buffer)
4) loop steps 2 and 3 until file position is 0/BOF Rob Marriott
rob@career-connections.net
fseek(yourFilePtr,offset,seektype) where seektype can be:
SEEK_CUR - current position
SEEK_END - end of file
SEEK_SET - begin of file
for reading file you can use fscanf.
There also exists many easyest function in STL, MFC.
John Fill
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.