Right, I have a script. You fill in a form and it writes the infomation one after the other.
Code
code:
How would I make it so that new entrie go at the top?
I've done a search before I posted, and it came up with nothing. So if this was been mnetioned before, please just point me in the direction and dont flame me
AFAIK, you can't write directly to the top of the file without overwriting the contents below... the ">>" in the open basically means "append". I think the seek() function only allows for binary editing of a file...
Here's a solution: (I hope)
Code
code:
Apologies for the inefficient code, but I'm on a foreign computer, and can't remember the "open AND write" option. ("+>" or something?)
Just curious, why do you need to write to the top instead of the end of the file? Everything can be read into an array and accessing the last elements are just as easy as the first. It makes no diff to the computer
"Annnnnnnndd now, opening for Iron Maiden...... WYLD STALLYNS!!!" --Bill S. Preston, Esquire and Ted "Theodore " Logan
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.