Docs » Autodocs » dos.library » SetVBuf
SetVBuf -- set buffering modes and size (V39)
error = SetVBuf(fh, buff, type, size) D0 D1 D2 D3 D4 LONG SetVBuf(BPTR, STRPTR, LONG, LONG)
Changes the buffering modes and buffer size for a filehandle. With buff == NULL, the current buffer will be deallocated and a new one of (approximately) size will be allocated. If buffer is non-NULL, it will be used for buffering and must be at least max(size,208) bytes long, and MUST be longword aligned. If size is -1, then only the buffering mode will be changed. Note that a user-supplied buffer will not be freed if it is later replaced by another SetVBuf() call, nor will it be freed if the filehandle is closed. Has no effect on the buffersize of filehandles that were not created by AllocDosObject().
fh - Filehandle buff - buffer pointer for buffered I/O or NULL. MUST be LONG-aligned! type - buffering mode (see <dos/stdio.h>) size - size of buffer for buffered I/O (sizes less than 208 bytes will be rounded up to 208), or -1.
error - 0 if successful. NOTE: opposite of most dos functions! NOTE: fails if someone has replaced the buffer without using SetVBuf() - RunCommand() does this. Remember to check error before freeing user-supplied buffers!
Not implemented until after V39. From V36 up to V39, always returned 0.
FPutC(), FGetC(), UnGetC(), Flush(), FRead(), FWrite(), FGets(), FPuts(), AllocDosObject()
|