First off I'm new to raspberrypi/linux etc, I've been working with Arduino and trying to make my program faster with the Pi.
I'm working with UART device sending and receiving data. I can open the port, send data, receive data, and close the port without a problem. I'm having trouble with ignoring the CR. So I get data like this from the device:
Don't send the whole buffer, just send what you need. If you need to strip off \n, then ... I'm asuming sendString is a char array.
1 2 3 4 5 6
// Look for \n, replace it with null
if (constchar* end = strchr(sendString, '\n'))
*end = '\0';
// send the string with the null terminator
write(fd, sendString, strlen(sendString) + 1);