[fpc-pascal] TIOStream and .Position
Žilvinas Ledas
zilvinas.ledas at dict.lt
Sun Dec 6 01:31:23 CET 2009
Yes, I am. But I thought that it is not that logical after I found function:
---
FPos: Int64;
---
and
---
function TIOStream.Seek(Offset: Longint; Origin: Word): Longint;
<...>
{ Try to fake seek by reading and discarding }
<...>
---
Either way, I have modified mine iostream code to return currently
available FPos: Int64 and now I can use Position to know how many bytes
were read from the time I have created input stream. It is usefull as I
am using generic TStream which in my app can be TFileStream,
TStringStream or TIOStream and now I can use the same stream.Position
with valid result (as long as I do not seek).
If it is intended behaviour to return -1 it is ok by me ;) I just wanted
to check if it wasn't a bug.
Regards,
Zilvinas Ledas
Jonas Maebe wrote:
> On 05 Dec 2009, at 21:42, Žilvinas Ledas wrote:
>
>
>> is this intended behavior or it is a bug that iostream.Position always returns -1?
>>
>
> Are you reading from standard input or so? In that case it's logical that the position is always -1, since you can't seek standard input (in theory it's infinitely large).
>
>
> Jonas_______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>
More information about the fpc-pascal
mailing list