open and read commands

fp at casabellagallery.com fp at casabellagallery.com
Sat Dec 1 18:19:16 PST 2007


Mike posted:

> This helped. I can now read the first line from the text document.
> 
> How do I get it to continue though the rest of the .txt document? It is only 
> reading the first line.
> 
> (txt) returns the text I am looking for and (x) seemed to be the length of 
> (txt)
> 
> 

You know, you would get better advise if you were to provide more detailed
information about what you actually needed to address.

You asked a very general question and got a very general answer.  If you
were to provide at least a sample string of what your text file looks like 
and a description of what you need/intend to do with it, then I am sure
some one will put up a sample script to help you get the job done.

Personally, I find that using import is simpler than open(), readline(), and seek()
for sequentially manipulating a file.

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.

Again, import will make your life a lot easier ... IMHO ... Using import 
you can stick to the traditional loop and read one line at a time

loop:if  :
    :then: import ascii ifile = c:\temp\somefile r=\n
    :if  : not ifile
    :then: end
    :if  :
    :then: ....  do some filePro stuff ....
    :if  :
    :then: goto loop


Regards,


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



More information about the Filepro-list mailing list