Re: Reading a text file

From: Bob Butler (tiredofit_at_nospam.com)
Date: 06/14/04


Date: Mon, 14 Jun 2004 07:36:37 -0700


"Brian" <bfordSPAMOFF@markem.com> wrote in message
news:%23jVl8vhUEHA.3780@TK2MSFTNGP10.phx.gbl
> I need to use VB6 to read in and parse through a text file one line
> at a time, I was hoping to use Line Input but that doesn't work
> becaue the text file only contains a line feed and no carriage
> returns.
>
> How can I read in 1 line at time with only the line feed to work
> with? do I have to do this one char at a time, I hope not :(

If the file isn't too big read it all into a single string and use
Instr/Left$/Mid$/Right$ to search for vbLf and pull the string apart or use
the Split function to make it into an array. If the file is larger than
you'd like to work with in one piece then read chunks at a time and do the
same thing - just be careful to retain any partial lines in each chunk read
when reading the next piece.

-- 
Reply to the group so all can participate
VB.Net... just say "No"


Relevant Pages

  • Re: XML to inMemory Hash
    ... Is there any way to create chunks so that it wont parse the entire file. ... I am planning to solve my memory issue by making the XML into Chunks ...
    (perl.beginners)
  • Re: XML to inMemory Hash
    ... Is there any way to create chunks so that it wont parse the entire file. ... I am planning to solve my memory issue by making the XML into Chunks ...
    (perl.beginners)
  • Re: create/use array from external txt file?
    ... Why not go for XML?...Its supported and will be a lot easier to parse it ... compare to text file... ... "Rissa" wrote in message ... I have broken all those chunks into separate ...
    (microsoft.public.pocketpc.developer)
  • Re: using fread
    ... > | I want to read it in chunks instead of a char at a time to allow me to ... and work with a local buffer instead: ... Now if someone would be so kind as to tell my how I can use mmap I would be ... This program will be used to parse multi gig files. ...
    (comp.unix.programmer)