PDA

View Full Version : rewind an open .txt file


clovis
2008-12-15, 09:35 AM
Hello,
Everybody knows the function (open file "w")
then (read-line file)
but is it possible to rewind the file to get back at the beginning of it?
Thanks

ccowgill
2008-12-15, 02:16 PM
Hello,
Everybody knows the function (open file "w")
then (read-line file)
but is it possible to rewind the file to get back at the beginning of it?
Thanks
you could possibly close it and reopen it, or open it with a separate variable and read-line.

I havnt tried it, but it sounded like a good idea.

rkmcswain
2008-12-15, 02:38 PM
What I generally do is open the file, read the entire file into a list, then close the file. Then you can operate on the list at your leisure without having to worry about opening the file again, or keeping the file open for a long period of time.

clovis
2008-12-15, 05:35 PM
Hello
Yes rkmcswain it's also what I did.
I asked about it because in C++ I can refer to the index of the line which I want to modify.
the file stayed open just for a few 1/10 s.
I've finished what I wanted to do : update 4000 metafiles.
Next, if I have the time, would be to update the "drawing properties" according to its metafile without loading the drawing in Acad.
Thanks