How can i save text to a specific line on a text document?
Printable View
How can i save text to a specific line on a text document?
For Example:
Save "BOB" to line 5 on Save.text
You need to open the file in binary and use
Put#filenumber,position,string will put your string at the certain position of your file
Oh, then you should input all the lines in a varlen string array, modify the fifth string and then print it back to the file
Could you explain a little further? Sorry im kinda new at this and ive had this VB3 so long that i lost the book and all my references. I need to get VB6 soon
I meant something like this:
I haven't tested it so there might be bugsCode:Dim a$(),ff%,n%:redim a(0)
ff=freefile
Open file for input as ff
do
redim preserve a(ubound(a)+1)
input#ff,a(ubound(a)-1)
loop untile eof(ff)
close ff
redim preserve a(ubound(a)-1)
a(5)="BOB"
ff=freefile
Open file for output as ff
for n=0 to ubound(a)
print#ff,a(n)
next n
close ff
I can figure them out...Thanks alot :)