Re: Thanx

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Fri, 29 Aug 1997 19:16:39 -0400 "Wallace B. Riley"
<wryly at MINDSPRING.COM> writes:
>Michael Bolin apparently misunderstood my other question about
>'restore'.  He suggested 'seek' in the library.
I think you are misunderstanding Euphoria's seek(). It allows you to
position yourself any place you want in a file.

Syntax:      include file.e
              i1 = seek(fn, i2)

 Description: Seek (move) to any byte position in the file fn or to the
end of
              file if i2 is -1. For each open file there is a current
byte
              position that is updated as a result of I/O operations on
the
              file. The initial file position is 0 for files opened for
read,
              write or update. The initial position is the end of file
for
              files opened for append. The value returned by seek() is
0 if the
              seek was successful, and non-zero if it was unsuccessful.
It is
              possible to seek past the end of a file. In this case
undefined
              bytes will be added to the file to make it long enough
for the
              seek.

>I want to find something that may be in the file, but I don't
>know where it is or even for certain that it exists.  The only
>way to find it is to start at the beginning looking at each item
>and saying, "No, that's not it ... that's not it ... that's not
>it," and finally, "THAT'S IT!" or "Sorry, it's not here."

Just seek(fn,0) before each search and you will start searching at the
top of the file each time.

For the data in your example remember to handle the multiple names or
each time you search for "Ben*" you will get the first one in the list.

Larry D. Poos
-[USMC (Retar{bks}{bks}ired) Havelock, NC]-
- Programming and System Consultant, LTAD Enterprises -

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu