X-Git-Url: http://git.hcoop.net/bpt/guile.git/blobdiff_plain/e140d85d5346f6cc3bd8b9f3954b063e159a2708..fb50a753e125f77093826963fd786b9592f7e08d:/doc/ref/api-io.texi diff --git a/doc/ref/api-io.texi b/doc/ref/api-io.texi index 5ca3506a9..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: