
at(+Stream, -Pointer)

   Succeeds if Position is the position of the stream Stream.



Arguments
   Stream              Stream handle or alias (atom)
   Pointer             Integer or variable.

Type
   Stream I/O

Description
   Unifies Position with the position of the given Stream, which is
   defined as follows:

   For file streams, Position is the position in the file (the offset in
   bytes from the beginning of the file) where the next read/write operation
   will occur.

   For tty read streams, Position is the number of bytes already read from
   the tty. For tty write streams, Position is the number of bytes already
   written to the tty.

   For pipe read streams, Position is the number of bytes already read from
   the pipe. For pipe write streams, Position is the number of bytes already
   written to the pipe.

   For socket streams, Position is the number of bytes already read from
   the socket.

   For string streams, Position is the position in the string (the offset in
   bytes from the beginning of the string) where the next read/write operation
   will occur.

   For queue read streams, Position is always 0. For queue write and queue
   update streams, Position is the number of unread bytes in the queue.

   For the null stream, Position is always 0.


   Stream can be a symbolic stream name or a stream handle.


Modes and Determinism
   at(+, -) is det

Exceptions
     4 --- Stream is not instantiated.
     5 --- Pointer is instantiated to a non-integer.
     5 --- Stream is instantiated to neither to an atom nor a stream handle.
   192 --- Stream is an illegal stream mode.

Examples
   
Success:
      ?- open(file1,write,S), at(S, P1),
         write(S, 1234567890), at(S, P2), close(S).
      P1 = 0
      P2 = 10


      ?- open(file1,update,S), at(S, P1), read(S, T),
         at(S, P2), close(S).
      P1 = 0
      T = 1234567890
      P2 = 10

Error:
      at(Stream, 4).      (Error 4).
      at("3", Position).   (Error 5).
      at(7, 4.3).         (Error 5).


See Also
   at_eof / 1, seek / 2
