Baud rate Arduino/Linux
Setting baud rates in a C program isn't a trivial task. You need to use the low-level open() instead of fopen() and act on the returned file descriptor with ioctl() or tcsetattr() / tcgetattr().  The former method allows the setting of non-standard baud rates while the latter only allows specific baud rates to be used.

I wrote a C++ class to deal with it all for me a while back. You are welcome to examine the methodology and/or steal whatever bits of it you like to use in your own program.


https://github.com/majenkotech/SerialPort