Setting serial port mode RS232/RS485 in c program

Hello,
You might have a look at this thread. One option is calling the script from your C program.