Jean-Guy2000
March 29th, 2001, 08:59 AM
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
Iouri
March 29th, 2001, 09:51 AM
'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
iouri@hotsheet.com
Jean-Guy2000
March 29th, 2001, 10:10 AM
I wanted to do it without using open binary. I was wondering if it can be done with the FSO.
Jean-Guy