First, lets remind ourselves of how we access files in VB. The first step is to get a free file number using the FreeFile method. We then use the Open statement to open the file, specifying any options we want:
nFileNum = FreeFile
Open sFile For Binary Access Write Lock Read Write As #nFileNum
In this case, we open the file specified in sFile for binary write access (Binary
Access Write
), and prevent the file from being read and modified by other
programs (Lock Read Write
).
We would then read or write to the file as necessary, and when finished call the Close method:
Close #nFileNum
Now that we've quickly reminded ourselves of how file access works, we can get on to outputting a binary file.
Comments