tags:

views:

99

answers:

2

Hey, I'd like to write to a text file to record a set of scores. However, everytime I write to it it overwrites what was originally in the file. Please can someone tell me how to not let it overwrite what is there or how to make it start writing in an empty space. Thank you in advance.

+6  A: 

Open the file 'for append'.

This will erase the file:

Open "C:\path\to\file.txt" For Output As FILE

This will not erase the existing content:

Open "C:\path\to\file.txt" For Append As FILE
Konerak
Thank you very much, this has worked fantastically
Emma
A: 

VB6's file manipulation sucks. If you have to read a file and immediately write the data out (that is not appended) in the same loop for a conversion/some sort of manipulation. Open the original file, manipulate it but write to a "new" file with a different name in the same directory. At the end of the process, you save the new file, delete the original and then rename the new file to the old.

jasonk