open and read commands

fp at casabellagallery.com fp at casabellagallery.com
Mon Dec 3 07:22:21 PST 2007


Ken posted:

> [...]
> > That said, to answer your question:
> > - You MUST look into the usage of openline(), readline() and seek() to
> > get the job done.  Readline() alone will not do what you are thinking of,
> > at least not the way you are approaching it (just speculating judging from
> > your posts).  You need to use seek() to place your pointer, readline() to
> > extract content.
> [...]
> 
> I'm not sure where you think that SEEK() fits into things here.  If you
> want to sequentially read the file, then READLINE() all by itself will
> suffice, as each call will return the next line.  (Assuming, of course,
> that each thing you want to read is terminated with a newline.)
> 

I stand corrected!

I think to remember having experienced unexpected behavior when using
readline() on a file where each line had different lengths (terminated
with newline).  When I ran the loop, I think the line termination made
no difference and the string returned was based on chucks/blocks of 
data determined by the given parameters ...

I could very well be mistaken but I do recall having had such an experience.
It was then when I figured that the seek() function needed to be paired
with readline() to move pointer relatively and extract as pointer is moved.

The truth is that I gave up on readline() then since I found it too
cumbersome compared to import ... and since all I wanted was to read a file
sequentially, import did the job pretty easily.

That said, I will bring myself up to speed with readline() thanks to your
explanation.

Regards,


---
Jose Lerebours
954  559  7186
http://www.fpgroups.com





More information about the Filepro-list mailing list