Appendix C • • Example Program
47
if (count > 80)
count = 80;
/* Read data from port */
if ((count = sio_read(port_no, data, count)) < 0) {
printf("Port #%2d sio_read() error !\n", port_no);
exit;
} else if (count > 0) {
data[count] = 0;
printf("%s", data);
}
/* Write data ABCDEFGHIJ to port */
sio_putb(port_no, "ABCDEFGHIJ", 10 );
i--;
}
}
sio_flush(port_no, 2); /* Flush port's input & output queues */
sio_close(port_no); /* Close port */
}