USING LINUX WITH EV3 DEVICES
{
/* Error Management Routine */
} else {
/* ttyUSBx Device Opened */
}
{
read()
The read() function reads nbyte bytes from the file associated with the open file descriptor, fildes, and copies them
in the buffer that is pointed to by buf.
Header File
unistd.h
Prototype:
ssize_t read(int fildes, void *buf, size_t nbyte)
Parameters:
fildes - file descriptor
buf - destination buffer pointer
nbyte - number of bytes that read() attempts to read
Returns:
The number of bytes actually read if the operation is completed successfully, otherwise it is -1.
Example
Read sizeof(read_buff) bytes from the file associated with fd and stores them
into read_buff.
char read_buff[BUFF_LEN];
if(read(fd, read_buff, sizeof(read_buff)) < 0)
{
/* Error Management Routine */
} else {
/* Value Read */
}
write()
The write() function writes nbyte bytes from the buffer that are pointed by buf to the file associated with the open
file descriptor. fildes.
Header File
unistd.h
Prototype:
ssize_t write(int fildes, const void *buf, size_t nbyte)
58
®
MultiConnect
PCIe MTPCIE-EV3 Developer Guide
Need help?
Do you have a question about the MultiConnect MTPCIE-EV3 and is the answer not in the manual?
Questions and answers