Results 1 to 1 of 1

Thread: Adding Carriage Return problem... help please [Solved]

  1. #1
    Join Date
    Jun 2009
    Location
    AKL | New Zealand
    Posts
    62
    Thanks
    21
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Adding Carriage Return problem... help please [Solved]

    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:
    Qt Code:
    1. txStr = "#SEND";
    2. txStr = txStr.append(QChar(13));
    3. serialPort->write(txStr, 5);
    4. serRec = serReceive2();
    To copy to clipboard, switch view to plain text mode 

    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.
    Last edited by cooper; 9th August 2009 at 23:25.

Similar Threads

  1. Model/View problem in move from 4.2.3 to 4.3.0
    By jml in forum Qt Programming
    Replies: 3
    Last Post: 31st October 2007, 00:20
  2. Stored procedure return values problem
    By jgreetham in forum Qt Programming
    Replies: 7
    Last Post: 10th September 2007, 17:38
  3. Problem when adding XML support
    By Shawn in forum Qt Programming
    Replies: 9
    Last Post: 22nd May 2007, 13:27
  4. Replies: 2
    Last Post: 8th August 2006, 15:09
  5. Problem with custom widget
    By jnana in forum Qt Programming
    Replies: 3
    Last Post: 15th March 2006, 11:55

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.