Re: Fastest Way to Append Chars to Text File Rows in VB6.0



Rita,

If speed is really important, you might consider reading them also in
binary, it is much faster than Line Input. The fastest is to read a big
chunk (say 64K) and use Mid$ to read the individual 496 char. records.

Gary

"RitaG" <RitaG@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D08E89C8-AE3A-4AE4-AEF9-D7FC82D8267A@xxxxxxxxxxxxxxxx
> Thanks so much Jim and Bob for your quick responses.
> I didn't think about using the "Binary" option.
>
> Gotta love these forums!
>
> Rita
>
> "Jim Mack" wrote:
>
>> RitaG wrote:
>> > Hi.
>> >
>> > I have about 60 text files containing rows 496 chars long. I need to
>> > cycle through all these files and append some additional chars at the
>> > end of each row. Some of the files are large, containing over 1
>> > million rows.
>> >
>> > The options I'm currently thinking of are the FileSystemObject
>> > ReadLine (I may run out of memory using ReadAll), append the chars at
>> > the end of the line and then use WriteLine to write to an output
>> > file. I could also use the "Open" file method using a handle and the
>> > Print # statement. I don't know which is the fastest way.
>> >
>> > Any suggestions will be greatly appreciated!
>>
>> I don't think you'll find anything much faster than something along these
>> lines:
>>
>> Open "A" For Input As xx
>> Open "B" For Binary As yy
>> Do While Not EOF(xx)
>> Line Input #xx, Buf$
>> Put yy,,Buf$ & NewInfo$
>> Loop
>> Close xx
>> Close yy
>>
>>


.



Relevant Pages

  • Re: Fastest Way to Append Chars to Text File Rows in VB6.0
    ... > I have about 60 text files containing rows 496 chars long. ... > cycle through all these files and append some additional chars at the ... Using the FSO is pretty much guaranteed to be the slowest option. ...
    (microsoft.public.vb.general.discussion)
  • Fastest Way to Append Chars to Text File Rows in VB6.0
    ... I have about 60 text files containing rows 496 chars long. ... I need to cycle ... may run out of memory using ReadAll), append the chars at the end of the line ... Rita ...
    (microsoft.public.vb.general.discussion)
  • Re: Fastest Way to Append Chars to Text File Rows in VB6.0
    ... RitaG wrote: ... > I have about 60 text files containing rows 496 chars long. ... > cycle through all these files and append some additional chars at the ...
    (microsoft.public.vb.general.discussion)
  • Re: Opening large files for small amounts of data
    ... If the file is opened for Append, however, the only way to move ... to the last couple of lines for reading is to read each line starting from ... It acquires a handle to the file from the operating system. ... or re-writing an entire file at the destination (re-writing from ...
    (microsoft.public.vb.general.discussion)
  • Re: inserting in a file
    ... and thereby overwrite whatever I wrote earlier, ... append the new information to the first ... will move to the offset 0 in the 2nd block. ... All the other chars of the ...
    (comp.lang.c.moderated)