Re: Binary file read/write

Tech-Archive recommends: Speed Up your PC by fixing your registry




"expvb" <nobody@xxxxxxx> wrote
Here is a better version which most developers use:

Get InputFileNum, , DataBuffer
Do While Not EOF(InputFileNum)
Put OutputFileNum, , DataBuffer
Get InputFileNum, , DataBuffer
Loop

I'd respectfully disagree with your statement. I would
suppose (given the task of copying a file) that most
developers would use the FileCopy statement!

If the task involved modifying some data in the file,
then I would like to think most developers would
dimension the array large enough to hold the file
and grab it all in one go, (Get the entire array) then
do the modification in memory, and finaly write the
new file (Put the entire array) using just one Put
statement.

LFS


.



Relevant Pages

  • Re: Binary file read/write
    ... If the source test file is not too large, echo the DataBuffer content to the ... Get InputFileNum,, DataBuffer ... Put OutputFileNum,, DataBuffer ... Dim InputFileName As String ...
    (microsoft.public.vb.general.discussion)
  • Re: Binary file read/write
    ... Get InputFileNum,, DataBuffer ... Put OutputFileNum,, DataBuffer ... Get statement doesn't cause EOF to be true when it reads the last byte, so on the next read, EOF is set to True, and the variable contents remain unchanged. ...
    (microsoft.public.vb.general.discussion)
  • Re: Binary file read/write
    ... Get InputFileNum,, DataBuffer ... Put OutputFileNum,, DataBuffer ... Get statement doesn't cause EOF to be true when it reads the last byte, ...
    (microsoft.public.vb.general.discussion)
  • Re: Binary file read/write
    ... Get InputFileNum,, DataBuffer ... Put OutputFileNum,, DataBuffer ... Get statement doesn't cause EOF to be true when it reads the last byte, so on the next read, EOF is set to True, and the variable contents remain unchanged. ...
    (microsoft.public.vb.general.discussion)
  • Re: Binary file read/write
    ... Get InputFileNum,, DataBuffer ... Put OutputFileNum,, DataBuffer ... Get statement doesn't cause EOF to be true when it reads the last byte, ...
    (microsoft.public.vb.general.discussion)