Cee Joe wrote in post #995597:
>
> my mentor wants me to use the IO.pos to read the
> characters of the file until the character reaches the ">" symbol.
>

IO.pos() does not read in data, so you are going to have to ask your mentor what he means.   You should also ask your mentor if this is a lesson in how not to do things.  If he doesn't reply in the affirmative, then you should find a new mentor.


> I am extracting text from each entry I read in, something I have figured
> out already. I want to read the file line by line and just store each
> entry into a buffer when it reaches the ">" symbol. THen extract
> specific info from it later.
>

You told us you were not supposed to read the whole file into memory. If you store every line in an array, then you will have read the whole file into memory.  Once again, you are not being clear on what you want to do with the data.  You need to tell us which of the following you want to do:

1) Store every entry in an array, and "extract specific info from it later".

2) Read one entry, do something to the entry, then discard it and read in the next entry.


> The entry lengths all vary as there long
> and short lengths. File is in text mode.
>

Ok.

>> What problems is that giving you?  You can create a loop, read the
>> character at pos(i), then increment i, and do what Jess Gabriel y Galn
>> suggested.
>

You could use each_byte to read the file char by char (that assumes your file contains all ascii characters), then when you find a '>', seek() back to the start of the file, and use IO.sysread() to read:

 old_pos = 0
 pos() - old_pos

number of characters.  Then do something like:

old_pos = pos()

and keep doing that. But, you will be reading every entry twice, which is stupid.