Specifications

Include
<unistd.h>
Description
The read() function reads a block of data from a file or device. read() is wrapper function that passes
control directly to the read() function registered for the device driver associated with the open file
descriptor fd. The input argument, ptr, is the location to place the data read and len is the length of the
data to read in bytes.
Calls to read() are thread-safe only if the implementation of read() provided by the driver that is
manipulated is thread-safe.
Valid values for the fd parameter are: stdout, stdin, and stderr, or any value returned from a call to
open().
Return
The return argument is the number of bytes read, which might be less than the requested length
The return value is –1 upon an error. In the event of an error, errno is set to indicate the cause.
Related Information
fcntl() on page 14-57
fstat() on page 14-55
ioctl() on page 14-73
isatty() on page 14-74
lseek() on page 14-64
open() on page 14-66
stat() on page 14-60
write() on page 14-69
newlib Library Documentation
write()
Prototype
int write(int fd, const void *ptr, size_t len)
Commonly Called By
C/C++ programs
newlib C library
Thread-safe
See description.
Available from ISR
No.
NII5V2
2015.05.14
write()
14-69
HAL API Reference
Altera Corporation
Send Feedback