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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.txt file help

Status
Not open for further replies.

aldumil

Programmer
Sep 3, 2001
40
JP
I am trying to make a comment system using only a text file......only porblem is that it adds the new additions to the blog to the bottom of the text file, and ideas on how to get the new comments to the top of the text file?

 
I would be likely to read the whole file and parse it first then display back the results in the reverse order.

Hope it helps B-)
 
yes but I only want the first 5 five posts to be written to the page.....?
 
Ok, so after reading the file and parsing it, display back the entries in reverse order, stopping after 5. If you want to do less reading and parsing, maintain a second file as an index where each record would contain two fields, starting_byte_pos and ending_byte_pos, that costs a tiny bit when adding entries, but should save quite a bit when it comes to displaying them back, the more frequent operation. B-)
 
ok.......I was actually looking for some coded help cause I still relativly new at this stuff. thank you though I have the framework laid out for the script
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top