how to use serial port in binary mode

I am sending binary data over a serial (rs-232) port.
a 0xD is getting inserted before 0xA
It seems to me that the port is configured to work in text mode, not in binary.
Here are the flags I am using
/* Open the serial port */
sfd = open(serial_port, O_RDWR | O_NONBLOCK);

How do I configure the port to work in binary mode?

Thanks for helping.

Look up TermIO in the help file. Big subject.

the flags available for the open() function are
O_RDONLY open for reading only
O_WRONLY open for writing only
O_RDWR open for reading and writing
O_NONBLOCK open for non-blocking

none of them appears to be relevant to the problem.

OK, found the flag

struct termios
tcflag_t c_iflag; /* input modes /
tcflag_t c_oflag; /
output modes /
tcflag_t c_cflag; /
control modes /
tcflag_t c_lflag; /
local modes /
tcflag_t c_xflag; /
Xtra flags /
cc_t c_cc[NCCS]; /
control chars */
speed_t baud;

code snippet:
termiosConfig.c_oflag &= ~ONLCR;

thanks for pointing me in the right direction.

You are welcome. Actually, you may have solved a bug I had. I get serial communication errors when I talk over the serial connection. I am looking into it.