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

Simultaneous Input/Output from a file?

Status
Not open for further replies.

robbaggio

Programmer
Jun 11, 2002
31
0
0
US
Is it possible to read in a line of data from a file, change the data, and then write it back to the file. Then go on to the next line and do the same, etc. Can this be done without opening up the existing file, reading from it, making the changes, and then writing it to another blank file?

If it is what command do i use to open up the file.

Open FILE For [Input | Output | Append] As 5

Input or Output?

thanks for any help
robbaggio
 
Yes. Open the file for binary.
However when you go back and forth in the file writting data you'll overwrite what is in that position already.
So for cahnges that have the same length as the original data it's great, but if the lenght differs it often pays off to load everything into a string (or byte array), maniputlate it, and then output everything agian to a "new" file.
See also thread222-314712 Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top