_read() Read Data from a File
#include <io.h>
int _read(handle,buf,nbyte);
int handle; Handle associated with file
void *buf; Buffer
int nbyte; Number of bytes to be read
_read() attempts to read 'nbytes' bytes from the file associated with
'handle' into the buffer pointed to by 'buf'. _read() is a direct
call to the MS-DOS read system call. 'handle' is a file handle
obtained from a creat(), open(), dup(), dup2() or fcntl() call.
_read() begins reading disk files at the current file pointer
position. When the reading is complete, the file pointer is
incremented by the number of bytes read. On devices, bytes are read
directly from the device.
Returns: If successful, the number of bytes read and placed in the
buffer is returned. On end-of-file, 0 is returned. On
error, _1 is returned and 'errno' (defined in <stdlib.h>)
is set to one of the following:
EACCES Permission denied
EBADF Bad file number
Notes: _read() does not remove carriage returns (as read() does)
and does not report end-of-file when a Ctrl-Z character
is read.
Seealso:
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster