PDA

View Full Version : Adding Carriage Return problem... help please [Solved]



cooper
9th August 2009, 22:59
hi guys,

i am writing a program to talk to an external device through serial port. this device is controlled by a string, and the string should be ended by a carriage return (CR).

here is part of my program:


txStr = "#SEND";
txStr = txStr.append(QChar(13));
serialPort->write(txStr, 5);
serRec = serReceive2();

after i finished my program, and tried to talk to the device, there was no response. then, i connected my pc to anther pc, and displayed the string, which i sent to that device, in hyper terminal. i found the string which i sent was correct, but just no carriage return. it looks like my carriage return character has been eaten somehow.

i tried to add "\n", "QChar(13)", "QChar(10)", none of them are working.

anyone can give me a hint, please?
thanks inadvance.


Edit:
problem solved. i made a stupid mistake.
i want to send a 6 characters string, but i told sending function that only sent 5 characters. :eek: