• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1758
  • Last Modified:

Open a Binary File for Appending

The statement "Open filename For Append As #1" opens an ASCII file for appending.  The statement "Open filename For Binary Access Write As #1" opens a BINARY file for writing.  Is there a statement that opens a binary file for APPENDING?  The following statement does not work:  Open filename For Binary Access Append As #1".
1 Solution
Mike TomlinsonMiddle School Assistant TeacherCommented:
Just open it and binary mode and move the file pointer to the end...thus making it ready for appending:

Private Sub Command1_Click()
    Dim FileName As String
    FileName = "c:\someFile.txt"
    Open FileName For Binary Access Write As #1
    Seek #1, LOF(1) + 1 ' move the file pointer to the end...thus appending!
    Put #1, , "something to be appended..."
    Close #1
End Sub
You made an assumption that only text files can be opened for Append mode, not i :-)

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now