Results 1 to 2 of 2

Thread: QByteArray Problem

  1. #1
    Join Date
    Jun 2010
    Posts
    7
    Platforms
    Unix/X11 Windows

    Smile QByteArray Problem

    I Wrote a function as follow

    writedata(const char * buf);

    then I call the function ,

    QString test;
    test ="Hello world world";
    writedata(test.toAscii ());


    I pass the parameter which is QByteArray type, but the function accept type is char *,why it can work?


    Please help me,Thanks!
    Last edited by foxhengxing; 18th August 2010 at 02:43.

  2. #2
    Join Date
    Jun 2010
    Posts
    7
    Platforms
    Unix/X11 Windows

    Default Re: QByteArray Problem

    I have found the answer,the reason is QByteArray override the operate const char *() as follow

    QByteArray::operator const char * () const
    Thanks everyone!

Similar Threads

  1. XoR on hex/QByteArray
    By meena in forum Qt Programming
    Replies: 1
    Last Post: 13th July 2010, 15:41
  2. Replies: 0
    Last Post: 4th November 2009, 07:45
  3. Replies: 9
    Last Post: 25th July 2009, 13:27
  4. QByteArray problem
    By Misenko in forum Qt Programming
    Replies: 17
    Last Post: 4th October 2008, 21:53
  5. QByteArray in Qt3
    By joseph in forum Qt Programming
    Replies: 1
    Last Post: 6th September 2007, 06:16

Tags for this Thread

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.