[Gambas-user] What is faster: OPEN or File.Load?
Benoît Minisini
gambas at ...1...
Fri May 27 12:33:30 CEST 2011
> > When I have different directories which contain text files, and I have
> > to open each file and read only the first line of it, which one will be
> > faster and more efficient:
> >
> > FOR
> >
> > OPEN
> >
> > read first line
> >
> > CLOSE
> > list.Add
> >
> > NEXT
> >
> > or
> >
> > FOR
> >
> > File.Load(...)
> > Split(... chr$(10))
> > list.Add(...)
> >
> > NEXT
> >
> > Or wouldn't that be feasible in case of, say, 50 - 70 files in such
> > directories?
> >
> > Thanks for your comments :-)
> >
> > Rolf
>
> The second one is obviously faster. Just check the execution time!
>
> Regards,
Oops, sorry, I didn't see that you wanted just the first line. Then the first
one will be faster, unless you have very small files.
Regards,
--
Benoît Minisini
More information about the User
mailing list