Transmitting via serial port on linux using cpp

*This post is not getting displayed properly, but i do not know the problem here. Any ideas?

Hi all,
I am having trouble transmitting data. I have a cpp programm that should transmit and receive using this xbee board:
Receiving data works perfectly fine, but sending is a problem.

The Code:

//open USB port for read/write and check success
	ctx->fd = open(devFileName, O_RDWR | O_NOCTTY); //opens the usb port for reading
	if (ctx->fd < 0) {
		cerr << "Could not open the USB Port. Try adding User to group dialout!" << endl;
		return 0;
	//is the opened port a terminal?
	if(!isatty(ctx->fd)) {
		errno = ENOTTY;
		return 0;

	//setup termios
	tcgetattr(ctx->fd, &(ctx->oldtio));

	cfsetispeed(&newtio, baudrate);
	cfsetospeed(&newtio, baudrate);

	tcsetattr(ctx->fd, TCSANOW, &newtio);
	tcflush(ctx->fd, TCIFLUSH);
	lseek(ctx->fd, 0, SEEK_END);

	ctx->bufIO = fdopen(ctx->fd, "r+");

	bool connection_status=0;
	unsigned char frame_id=0x00;
	unsigned char checksum=0xff;
		unsigned char buffer[] = {
					 0x7E, //start delimiter  
					 0x00,0x07,//length of the data packet 
					 0x01,//API identifier (refer to XBee module manual for further details)
					 frame_id++, //frame id 
					 0x00,0x0B,//destination address	
					 0x02,0x03,//data: 0,receiver address,mode
					 0x00};			//checksumm
		for(unsigned int i=0;ibufIO);

But this does not work properly. I have an oscilloscope hooked up to the xbee to see data entering to be transmitted. But I do only get a signal of a few miliseconds, when the frame id is 0x0A. If i fix either the frame id or some other of the chars, for example the 0x02 to 0x0A then i get a signal of only one milisecond.

I am a little desperate by now, have been working on this for 1 week now.

In the checksum loop there is an [i] missing is just saw. But it is present in the original code. I dont know why the forum messed up my beutifull post so hard :frowning: