Post by Is there any C++ code for Serial (RS232) communication
compatible both with
Windows and Linux ?
Only using the pure System API? As long as you don't want to set
comm parameters (speed, databits, parity): Yes. Just do an
char comm_dev[80];
int const comm_nr;
#ifdef WIN32
#define COMM "COM%d"
#elseif
#define COMM "/dev/ttyS%d"
#endif
sprintf(comm_dev, COMM, comm_nr);
FILE *comm_f=fopen(comm_dev, "w+");
// your comm here
fclose(comm_f);
However if you want to set comm parameteres you will have to use
an OS dependent API. For windows that means that you will have
to use it's ugly file API.
--
Wolfgang Draxinger