|
-
January 7th, 2000, 02:44 PM
#1
binary file output
I'm having a little bit of trouble with writing data into a binary file. The following is my code:
Dim file as Integer
Open "tmp.bin" for binary as file
Put #file, , memBuf
Close file
the contents of memBuf are exactly how I want it to be. However, when I open up "tmp.bin" in a hex editor, there are 4 bytes of data at the beggining of the file, the second two bytes are the length of the entire file. I do not want those four bytes to be inserted. I assume it must be my use of the "Put" command, but I am not aware of any other command to write to a file. I would appriciate any pointers you all may have.
thanks
-
January 7th, 2000, 03:44 PM
#2
Re: binary file output
it appears you want to open the file tmp.bin and then enter the string memBUF into it...
why not try it this why?
FileNo = FreeFile
Open "tmp.bin" for binary as FileNo
Write #FileNo, memBuf
close FileNo
-
January 7th, 2000, 04:31 PM
#3
Re: binary file output
thanks for the reply. Using your method, it complained about opening the file as "binary" so I changed that back to "output". And using that it only inserted a single byte (always a quote - h22) at the beggining. So, while better then 4 bytes being inserted, still not good 
Anyway, after poking around some more, I found the "Print" command. So, the following code worked:
Dim file as Integer
file = FreeFile
Open "tmp.bin" for Output as file
print #file, memBuf
Close file
Thanks for your response, got me on my way 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|