From:                   Jeff 'japhy' Pinyan <[EMAIL PROTECTED]>
> On Jan 3, Booher Timothy B 1stLt AFRL/MNAC said:
> 
> >Why can't I do something like this? Load everything to a buffer then
> >cycle through the buffer?
> 
> Why would you want to?  That requires you to store the ENTIRE file in
> memory!

Which might be the right thing to do. Under certain circumstances.

Imagine you are reading the file from a mapped/mounted drive on a 
server to which you have a very very slow line. Or imagine some 
other program(s) append(s) to the file. So if you'd read it several 
times you might either get more data each time, or (if you do flock 
the file as you should) the other program will have to wait too long.

So while it's usualy better to read the file line by line even if you 
need to rewind and read it several times (and leave the buffering to 
the OS) there might be times when it's not.

So better than "You should never do X." would be to say "Are you 
really really sure you want to do X" ;-)

Jenda


== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
Always code as if the guy who ends up maintaining your code will be a
violent psychopath who knows where you live.
      -- Rick Osborne, <[EMAIL PROTECTED]>

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to