Home All Groups Group Topic Archive Search About

Sequential file access and binary file access

Author
5 Apr 2005 7:27 AM
kd
Hi All,

I have a .txt file, whose contents need to be read and processed. Which
among the following is the best way to do it?

- Using Sequential file access functions (FileOpen, LineInput, etc)
- Using binary file access functions (File.Open, FileGet, etc)

Thanks,
kd

Author
5 Apr 2005 7:36 AM
Cor Ligthert
KD,

For me the best choise is not between them, that is the Streamreader, the
speed of a file on disk is never faster than that the disk, which is always
slower than your program, so for performance you should not look for this.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemiostreamreaderclasstopic.asp

I hope this helps,

Cor
Author
5 Apr 2005 8:01 AM
kd
Hi Cor,

When should one use sequential file access and when to use binary acess to
read .txt files?

Thanks,
kd

Show quoteHide quote
"Cor Ligthert" wrote:

> KD,
>
> For me the best choise is not between them, that is the Streamreader, the
> speed of a file on disk is never faster than that the disk, which is always
> slower than your program, so for performance you should not look for this.
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemiostreamreaderclasstopic.asp
>
> I hope this helps,
>
> Cor
>
>
>
Author
5 Apr 2005 8:20 AM
Cor Ligthert
KD,

When all characters(bytes) are readable as txt file, you should in my
opinion never use the binary access.

However just my thought, I never tried it because I even don't think about
another way.

Cor