Results 1 to 3 of 3

Thread: i want use tcpsocket send a uchar data,, but there is no function conversion uchar to

  1. #1
    Join Date
    Apr 2009
    Posts
    35
    Thanks
    9
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Android

    Default i want use tcpsocket send a uchar data,, but there is no function conversion uchar to

    i want use tcpsocket send a uchar data,, but there is no function conversion uchar to QByteArray

    how can i use qtcpsocket send const unsigned char* src data ?

    conversion to
    QByteArray ?
    QChar ?

    Qt Code:
    1. this->m_tcpSocket = new QTcpSocket(this);
    2. this->tcpSocket->connectToHost("192.168.0.111",8888);
    3. connect(this->tcpSocket,SIGNAL(connected()),this,(sendData()));
    4.  
    5. sendData function
    6.  
    7. {
    8. const unsigned char* src = some unsigned char data
    9.  
    10. this->tcpSocket->write(?,size) ?
    11.  
    12.  
    13. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 5th November 2010 at 17:40.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: i want use tcpsocket send a uchar data,, but there is no function conversion ucha

    Just cast it to a char

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

    tsuibin (6th November 2010)

  4. #3
    Join Date
    Jul 2018
    Posts
    3
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: i want use tcpsocket send a uchar data,, but there is no function conversion ucha

    tcpSocket->write((char*)src, size);

Similar Threads

  1. duplicate data on TCPSocket
    By daemonna in forum Qt Programming
    Replies: 9
    Last Post: 4th August 2010, 07:29
  2. Problem with receiving Data from TcpSocket
    By Basti300 in forum Qt Programming
    Replies: 0
    Last Post: 15th July 2010, 15:41
  3. problem in data type conversion
    By sksingh73 in forum Newbie
    Replies: 2
    Last Post: 24th June 2010, 03:12
  4. Replies: 4
    Last Post: 8th January 2008, 19:41
  5. Creating a QImage from uchar* data
    By forrestfsu in forum Qt Programming
    Replies: 6
    Last Post: 8th February 2007, 16:21

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.