PDA

View Full Version : write to a file


Dimava
Mon 2nd Sep '02, 10:31pm
I have a file thats like this:

5
Hi
Bye
Just
Testing
Etc.


the number 5 reflects on how many lines there are under the first line

and I have a script that allows me to add more words to the list

would it be possible to be able to read the first line of the file, take the number, and add 1 to it and insert it as the first row

thanks,

Dimava

scoutt
Thu 5th Sep '02, 5:57pm
hey Dim,

sure you can. when you open the file to write just use the "w" instead of w+ that way it sets the pointer to the top of the file.