After you've
open()ed the device, do a
tcgetattr() on it to get the current attribute settings, modify what you want, and set the modified attributes using
tcsetattr().
You'll for sure want to turn off
ICRNL, but consider changing other bits too.
Don't forget to save the original attributes, and restore them just before you
close() the device.
Read this and (to save time in the long run) make sure you understand it completely, or at least everything concerned with
tcgetattr() and
tcsetattr():
If that doesn't make things clear, consider googling for this:
Hope this helps.