Re: Reading from a stream til EOF
"Hendrik Schober" <SpamTrap@gmx.d e> wrote in message
news:c1l3es$6fo $1@news1.transm edia.de...[color=blue]
> tom_usenet <tom_usenet@hot mail.com> wrote:[color=green]
> > [...][/color][/color]
[color=blue]
> I didn't think of seeking through a
> stream to get its size! Of all the
> reasons I wanted to do this I did
> manage to eliminate all except that
> I need the size of the data to be
> read from the stream. Since you just
> showed me how to get this, I won't
> even need to read the whole thing
> into a string anymore![/color]
This is fine depending on the stream type. As I'm sure you know, an
arbitrary stream deosn't have to be arbitrarily-positional. If you
know that the streams you will be using are arbitrarily-positional,
you're all set.
You could try seeking, and then testing whether the result is a valid
stream poosition. If it's not, you could then use another method.
However, I'm not sure its guaranteed that a stream will be in a valid
state after a failed seek.
Jonathan
"Hendrik Schober" <SpamTrap@gmx.d e> wrote in message
news:c1l3es$6fo $1@news1.transm edia.de...[color=blue]
> tom_usenet <tom_usenet@hot mail.com> wrote:[color=green]
> > [...][/color][/color]
[color=blue]
> I didn't think of seeking through a
> stream to get its size! Of all the
> reasons I wanted to do this I did
> manage to eliminate all except that
> I need the size of the data to be
> read from the stream. Since you just
> showed me how to get this, I won't
> even need to read the whole thing
> into a string anymore![/color]
This is fine depending on the stream type. As I'm sure you know, an
arbitrary stream deosn't have to be arbitrarily-positional. If you
know that the streams you will be using are arbitrarily-positional,
you're all set.
You could try seeking, and then testing whether the result is a valid
stream poosition. If it's not, you could then use another method.
However, I'm not sure its guaranteed that a stream will be in a valid
state after a failed seek.
Jonathan
Comment