• Log in or sign up for an account here: https://www.sythe.org/login

save file

bloodbaron20

Newcomer
Joined
Mar 6, 2008
Sythe Gold
0
Messages
8
save file
hi i got an question about saving a file,
i got this code
Code:
Private Sub timer1_timer()
Timer1.Enabled = False
Open "c:\file path" + home.foto.Text + "\index.html" For Append As #1    ' Open file for output.
Write #1, Index.Text
' Close before reopening in another mode.
Close #1
End Sub

Private Sub Form_Load()
Timer1.Enabled = True
End Sub
and it works but when i open the file there stands ""
so how can i save the file withouth " " ?
 
save file
At the moment you would just be adding whatever is in the Index (bad name, btw) textbox to the end of a file, because that's what append does. This is bad because the file size will constantly increase. Append also adds "" to strings when you output them into a file.

So, if you want a way around this you would use the "Binary" and "Put" method.

Code:
Dim LengthOfFile As Long
    Open "c:\file path" & home.foto.Text & "\index.html" For Binary As #1 'Open the file for editing.
    
        LengthOfFile = LOF(1) 'Get the current length of the file and store it in the "LengthOfFile" Long.
        
        Put #1, LengthOfFile + 1, Index.Text 'Write the data in the Index textbox to the end of the file.
        
    Close #1 'Close the file.

If you want me to explain more, post.
 
Runescape Gamblingrunescape gambling
Back
Top