|
-
March 29th, 2001, 09:59 AM
#1
binary file i/o
How do I read/write a file 1 byte at a time? I tried using OPEN "file.bin" for binary read. This works but is very slow. I looked at the FileSystemObject but only seem to find Textfileopen and write. Can the FSO do binary? is there a better way then the old OPEN command?
Jean-Guy
-
March 29th, 2001, 10:51 AM
#2
Re: binary file i/o
'to write
Open App.Path & "\temp.enc" For Binary As #1
Put #1, 1, 0 '#file,position,char
Put #1, 2, 128
Put #1, 3, 0
Put #1, 4, 128
'to read
Open InFile For Binary As #2
Do While Not EOF(2)
'Add one to the record number to obtain
pos = pos + 1
'Obtain the next character in the infile
Get #2, pos, char '#file, pos,char
'Write the next character in the infile
Put #1, pos + 4, char + 128
Loop
Close #2
Close #1
Iouri Boutchkine
[email protected]
-
March 29th, 2001, 11:10 AM
#3
Re: binary file i/o
I wanted to do it without using open binary. I was wondering if it can be done with the FSO.
Jean-Guy
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
|