set_stream_position(@stream_or_alias, @stream_position) [ISO]

This built-in predicate assigns a given position to the position property of a given stream, this is only possible if the property reposition(true) was specified while opening the stream, see open/4. The stream_position parameter must be an integer. The position of the first character is 0. The predicate succeeds with empty substitution if it was successful if the stream could not be repositioned then it fails.

see also: at_end_of_stream/0 at_end_of_stream/1 close/1 close/2 close_user_streams/0 current_input/1 current_output/1 flush_output/0 flush_output/1 open/3 open/4 prolog I/O set_input/1 set_output/1 set_stream_property/2 stream_property/2

Example
set_stream_position(user_input,   1). the stream_position was set to 1 for the stream user_input

 

Exceptions  
stream_or_alias is a variable an instantiation_error exception is thrown
stream_or_alias is neither a variable nor a stream term nor an alias a domain_error(stream_or_alias, Stream) exception is thrown, the variable Stream is assigned the incorrect stream_or_alias term
stream_or_alias is not associated with an open stream an existence_error(stream, Stream) exception is thrown
stream_or_alias has stream_property reposition(false) a permission_error(reposition, stream, Stream) exception is thrown
Position is a variable an instantiation_error exception is thrown
Position is neither a variable nor a stream position term a domain_error(stream_position, Position) exception is thrown

 

 

info@trinc-prolog.com