Results 1 to 5 of 5

Thread: qextserialport taking value 0 as null ?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2007
    Location
    Grenoble, France
    Posts
    80
    Thanked 9 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qextserialport taking value 0 as null ?

    What's the difference between NULL and 0x00?

    You have
    Qt Code:
    1. char buff[2];
    To copy to clipboard, switch view to plain text mode 
    and then you read some unknown number of characters. Are you sure there are only two to read?

    Are you sure, that all the characters (whole frame) are read before you use QTextBrowser::append() ? If not, you'll see some characters in new line every time you run this code.
    You have to run a level 3 diagnostic.

    Ashes to ashes, Qt to Qt ( wysota )

  2. #2
    Join Date
    Mar 2008
    Posts
    46
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: qextserialport taking value 0 as null ?

    Hi

    What's the difference between NULL and 0x00?
    For me in my program null means nothing no value, But 0x00 is taken as null i din't want that happen because i have some service request with 0x00.

    char buff[2];
    Sorry that was a mistake , I changed it to 1024 but forgot to change it while i posted it here.

    Hey so is there any way i can take 0x00 as a normal hex number. Actually i receive this frame from the target board. I send a request frame in response to it the target board sends back a frame which may have 0x00, and if 0x00 is received the frame is broken and the hex values after 0x00 are taken has a second frame. How can i avoid this.


    Thank You.

  3. #3
    Join Date
    Oct 2007
    Location
    Grenoble, France
    Posts
    80
    Thanked 9 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qextserialport taking value 0 as null ?

    Instead of this
    Qt Code:
    1. QByteArray msg = buff;
    To copy to clipboard, switch view to plain text mode 
    try
    Qt Code:
    1. QByteArray msg = QByteArray::fromRawData(buff,numBytes);
    To copy to clipboard, switch view to plain text mode 
    or
    Qt Code:
    1. QByteArray msg = port->read(numBytes);
    To copy to clipboard, switch view to plain text mode 

    Sorry, i think i din't read your post carefully last time
    Last edited by calhal; 11th August 2008 at 07:49. Reason: Forgot something
    You have to run a level 3 diagnostic.

    Ashes to ashes, Qt to Qt ( wysota )

  4. #4
    Join Date
    Mar 2008
    Posts
    46
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Thumbs up Re: qextserialport taking value 0 as null ?

    Hey thanks for the help it worked. !!!

    I changed it to

    QByteArray msg = QByteArray::fromRawData(buff,numBytes);
    and now i am able to even receive zeros . Thank You again friend.



    Cheers
    Dheeraj

Similar Threads

  1. Problem at time compilation in traslation of language
    By thomasjoy in forum Qt Programming
    Replies: 3
    Last Post: 22nd May 2007, 14:18

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
  •  
Qt is a trademark of The Qt Company.