Home > Software engineering >  Questions about writing sequential file
Questions about writing sequential file

Time:10-05

If I now have a TXT text, it already has a line of text, and then I want to have a new input text from the first at the end of the line continue to write, not another one line, but continued to write in the first line, have what way? Before tried to open the file for append this command, but seems to be another line of continue to write,,

CodePudding user response:

Starting from the first time to write, don't always write a newline, could not have been written down on the first line,
 Dim hFile As Integer 

HFile=FreeFile ()
Open "C: \ temp \ 1. TXT" For Append As # hFile
Print # hFile, Now; '& lt; - the key is the semicolon '
Close # hFile

CodePudding user response:

Like this can meet your requirements:
 
Private Sub Command1_Click ()
"C: \ 1. TXT" Open For Binary As # 1
The Seek # 1, LOF (1) + 1
Put # 1, Text1. Text
Close # 1
End Sub
  • Related