TPMC866-SW-42 - VxWorks Device Driver
Page 18 of 37
EXAMPLE
#define
BUFSIZE
100
…
int
fd;
char
buffer[BUFSIZE];
int
retval;
…
/*------------------------------
Read data from specified device
------------------------------*/
retval = read(fd, buffer, BUFSIZE);
if (retval != ERROR)
{
printf(“%d bytes read\n”, retval);
}
else
{
/* handle the read error */
}
RETURNS
Number of bytes read or ERROR. If the function fails an error code will be stored in
errno
.
SEE ALSO
ioLib, basic I/O routine - read()