open and read commands

Bob Stockler bob at trebor.iglou.com
Mon Dec 3 08:03:29 PST 2007


fp at casabellagallery.com wrote (on Mon, Dec 03, 2007 at 08:22:21AM -0700):

| 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.

You need to read the file into a variable of undefined length
and specify a length to be read that is greater than the longest
possible line to be read.

Bob

| 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
| 
| 
| 
| _______________________________________________
| Filepro-list mailing list
| Filepro-list at lists.celestial.com
| http://mailman.celestial.com/mailman/listinfo/filepro-list

-- 
Bob Stockler +-+ bob at trebor.iglou.com +-+ http://members.iglou.com/trebor


More information about the Filepro-list mailing list