opening n reading fm a serial port

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

QNX com ports named /dev/serX :slight_smile:

sry i need to correct myself, ive used /dev/serX correctly in my program.here it is just a typing error. can someone send me a code which actually sends data out of the serial port.

fd = open ( “/dev/ser1”, O_RDWR );

write ( fd, buffer, sizeof( buffer ) );

close (fd)

how d u work on IDE if u login as non root. it gives a message “u have to be non root for this”. i need to use the ThreadCtl command in my prog.