Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read file from the end

Status
Not open for further replies.

raghu75

Programmer
Nov 21, 2000
66
IN
All
Does anyone know any function or algo which can read a file from the end to the beginning.
pl. let me know
 
You can use fseek. fread also can be used to read from a relative from current position or absolute to the end or the gebin of file. John Fill
1c.bmp


ivfmd@mail.md
 
see my code and explain me

fseek(pFile,0L,SEEK_END);
--here if use fread/fscanf etc..it reads the EOF..
but i need to travel back wards..

For Eg if my file contains the following..

This is a file for test

My first statement places my pointer at the char 't'.if i say fread/fgets/..etc..it returns the EOF but i need to read backwards ie. ..test for file a is This.. like this...
Ur View Pl.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top