Results 1 to 2 of 2

Thread: QDataStream and qDebug()

  1. #1
    Join Date
    Nov 2007
    Posts
    291
    Thanks
    85
    Thanked 1 Time in 1 Post

    Question QDataStream and qDebug()

    hi
    i have a code like this .

    Qt Code:
    1. QDataStream in(socket);
    2. qDebug()<<in;
    To copy to clipboard, switch view to plain text mode 


    i need to output the contents in the QDataStream ,how to achieve this

    bye

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

    Default Re: QDataStream and qDebug()

    Qt Code:
    1. char* s = NULL;
    2. uint length = 0;
    3. in.read(s, length);
    4. if(length >0)
    5. {
    6. qDebug("%s", s);
    7. delete[] s;
    8. }
    To copy to clipboard, switch view to plain text mode 

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

    babu198649 (19th December 2007)

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.