Results 1 to 5 of 5

Thread: Passing Specific Binary Characters in QTcpSocket.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2007
    Posts
    59
    Thanks
    7

    Default Re: Passing Specific Binary Characters in QTcpSocket.

    That did indeed fix the double byte characters in the QString.. however i still have many additional bytes where on the 0x02 should be...

    So, i made a test..

    with this code:
    Qt Code:
    1. QDataStream out(&data, QIODevice::WriteOnly);
    2. out.setVersion(QDataStream::Qt_4_1);
    3. out << int(0x02);
    4. tcpSocket->write(data);
    To copy to clipboard, switch view to plain text mode 

    I get this on the network..
    0x00000002

    What I need to see is :
    0x02

    Is there a different way to define this instead of int(0x02) to make do only this hex character? and not the additional nulls?

    Thanks for the assistance...

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: Passing Specific Binary Characters in QTcpSocket.

    But you want to see 0x02(8 bits - 1 byte) and still you write an integer(32 bits - 4bytes).
    Write a qint8 instead:
    Qt Code:
    1. out << qint8(0x02);
    To copy to clipboard, switch view to plain text mode 
    Regards

  3. The following user says thank you to marcel for this useful post:

    nbkhwjm (2nd September 2007)

  4. #3
    Join Date
    Mar 2007
    Posts
    59
    Thanks
    7

    Default Re: Passing Specific Binary Characters in QTcpSocket.

    Thanks marcel,

    yes, that was a fundamental mistake... works great now..

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.