reading and writing-serial port.
1.to write a string to a serial port,
2. read this string from the port again
i'm using Serial Programming Guide for POSIX Operating Systems - Michael R Sweet as a reference.
this is the code snippet that i have put together:
the program is writing fine to the serial socket, but the read is not happening.
int file= open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NDELAY);
if(file == 0)
perror("open_port: Unable to open /dev/ttyS0 - ");
fcntl(file, F_SETFL, 0);
printf("enter input data:\n");
printf("cannot write to port\n");
fcntl(file, F_SETFL, FNDELAY);
printf("cannot read from port\n");
printf("do you want to send the next packet?(y/n):\n");
where am i going wrong?
a lot of the examples on this i have come across do some configuring at the port. is this essential?