i m a beginner so sorry for the simple question. i wish to read data from a serial port. for that i connected 2 PCs 1 running on windows XP and the other on QNX. i tried to send data via serial port with hyterminal on windows and a c program on the QNX end.
i used this command to open the port
#include <stdio.h> /* Standard input/output definitions /
#include <string.h> / String function definitions /
#include <unistd.h> / UNIX standard function definitions /
#include <fcntl.h> / File control definitions /
#include <errno.h> / Error number definitions /
#include <termios.h> / POSIX terminal control definitions */
/*
* 'open_port()' - Open serial port 1.
*
* Returns the file descriptor on success or -1 on error.
*/
int
open_port(void)
{
int fd; /* File descriptor for the port */
fd = open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NDELAY);
if (fd == -1)
{
/*
* Could not open the port.
*/
perror("open_port: Unable to open /dev/ttyS0 - ");
}
else
fcntl(fd, F_SETFL, 0);
return (fd);
}
Now the problem is that when i debug this i get in the debug view
“filename_g(running)
thread1 (suspended)
0main() filename.c at 14”
the no. is the line no of the command open()
i think i m supposed to get some indication on the console indicating that the port is open, but nothing comes up.
can someone plz tell me wat the problem is like, someone can suggest a better way to do this