Most users will want the advanced I/O capabilities included by using the Windows OVERLAPPED I/O API. We won't duplicate the documentation here, but for your reference, here is an article on a common bug developers introduce while trying to cancel I/O operations when using OVERLAPPED I/O.
Code |
Version |
serialfc-windows |
2.0.0 |
serialfc-linux |
2.0.0 |
serialfc |
1.0.0 |
int serialfc_read(fscc_handle h, char *buf, unsigned size, unsigned *bytes_read, OVERLAPPED *o)
Parameter |
Type |
Description |
h |
serialfc |
The handle to your port |
buf |
char * |
The data buffer to hold incoming data |
size |
unsigned |
The data buffer size |
bytes_read |
unsigned * |
How many bytes were returned from the read |
o |
OVERLAPPED * |
Overlapped IO structure |
#include <serialfc.h>
...
char idata[20] = {0};
unsigned bytes_read;
serialfc_read(h, idata, sizeof(idata), &bytes_read, NULL);