The code below processes incoming RS232 serial data 1 character at a time and works fine.
However the incoming serial feed in my use case does not contain any CR or LF characters which make further delimiting/processing to a piped program difficult. The end delimiter is always a ! exclamation character instead of a CR or LF. e.g. 123456!abcdef!qwerty!
Is there a way to modify the code below to substitute the ! character to a CR (carriage return)? For example, is the incoming string is 123456abcdef! then the program should replace the ! with a CR so it outputs 123456abcdef<carriage return>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <wiringSerial.h>
int main ()
for (;;)
{
putchar (serialGetchar (fd)) ;
fflush (stdout) ;
}
}