X-Git-Url: https://git.hcoop.net/bpt/guile.git/blobdiff_plain/521c542199afa4f199746d5bbffc18a988cb30bc..7c6ce75e2cc218e193b765149e619d1c9c69cbd6:/doc/ref/api-io.texi?ds=sidebyside diff --git a/doc/ref/api-io.texi b/doc/ref/api-io.texi index 8e3d40a69..e1501e2b4 100644 --- a/doc/ref/api-io.texi +++ b/doc/ref/api-io.texi @@ -443,8 +443,12 @@ open. @deffn {Scheme Procedure} seek fd_port offset whence @deffnx {C Function} scm_seek (fd_port, offset, whence) Sets the current position of @var{fd_port} to the integer -@var{offset}, which is interpreted according to the value of -@var{whence}. +@var{offset}. For a file port, @var{offset} is expressed +as a number of bytes; for other types of ports, such as string +ports, @var{offset} is an abstract representation of the +position within the port's data, not necessarily expressed +as a number of bytes. @var{offset} is interpreted according to +the value of @var{whence}. One of the following variables should be supplied for @var{whence}: @@ -460,7 +464,7 @@ Seek from the end of the file. If @var{fd_port} is a file descriptor, the underlying system call is @code{lseek}. @var{port} may be a string port. -The value returned is the new position in the file. This means +The value returned is the new position in @var{fd_port}. This means that the current position of a port can be obtained using: @lisp (seek port 0 SEEK_CUR) @@ -1792,6 +1796,10 @@ indicating the position of the next byte is to read. Finally, if @var{close} is not @code{#f}, it must be a thunk. It is invoked when the custom binary input port is closed. +The returned port is fully buffered by default, but its buffering mode +can be changed using @code{setvbuf} (@pxref{Ports and File Descriptors, +@code{setvbuf}}). + Using a custom binary input port, the @code{open-bytevector-input-port} procedure could be implemented as follows: @@ -1932,7 +1940,7 @@ exact integer object. If no characters can be read before an end of file, the end-of-file object is returned. @end deffn -@deffn {Scheme Procedure} get-string-all textual-input-port count +@deffn {Scheme Procedure} get-string-all textual-input-port Reads from @var{textual-input-port} until an end of file, decoding characters in the same manner as @code{get-string-n} and @code{get-string-n!}. @@ -2107,6 +2115,7 @@ index @var{start} and limiting to @var{count} octets. @deffn {Scheme Procedure} put-char port char Writes @var{char} to the port. The @code{put-char} procedure returns +an unspecified value. @end deffn @deffn {Scheme Procedure} put-string port string