Any suggestions on how to create the most efficient readLine method
wrapping readFile?
I am quite pleased with the performance of the file i/o API functions, but
wonder if I can get any improvement reading line-by-line over Line Input
#filenumber, buffer$. I'd like to get the functionality found in the
filesystemobject textstream readLine() method or in some of Java's stream
filter objects (no doubt where the filesystemobject got its idea).

Should I read a chunk of the file to a string, search for a vbcrlf, return
the found string, reset the file pointer to the char immediately after the
found vbcrlf pair? If so, what's a good chunk size - 2048 bytes? Something
quite larger? The whole file?
If one sets a non-fixed string to "", does it free the memory? Can a fixed
string have a length like 2048 or even larger?
(I find it's pretty fast to load an entire 6 meg file text file into a
string. If you can trust the timer() function, it consistently takes a
little under half a second on a P333. VB's own input(...filelen(filename))
reads the same file in about 1.5 seconds on the same machine. Using Line
Input one line at a time takes quite a bit longer of course.)

Or, should I load it to an array?

I could use Line Input for reading lines, but then I would have to close the
file, switch file i/o systems, read a line (perhaps only one), then close
the file and re-open it using the API - and I'm sure behind the scenes Line
Input is just calling readFile() somehow.

What about scanning a file or a chunk of a file or a large string for a
I've done some primitive tests and have found that using instr() to find it
is a bit more than twice as fast as using split(), which is slightly
unpredictable anyway (it never works right if you specify 1 as the number of
items to return).
I also tested reading a large buffer one character at a time, kinda like one
would do in C with pointer arithmetic but using mid$(), which may have to
scan the whole thing from the beginning itself. I found using that method
takes about 150 times as long as using instr().
Is there not a way to load a returned buffer into an array of bytes or
something and thereby get the benefit of using an array index for each
character? Of course, a byte in VB is a number.

Thanks for any help or any pointers (!) to any other information on doing
efficient, fast i/o from vb using the api - sites, articles, explanations,
techniques, even book title suggestions would be appreciated.