Connect to Arduino Mega serial interface by C code
This sounds like you might be having a baud rate mismatch. I have seen many cases where a device or library will default to a particular baud rate and wont be an issue until switching devices or platforms.

The other possibility is using a serial class that only works on linux.