Results 1 to 6 of 6

Thread: why can't i write some string to the socket

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default why can't i write some string to the socket

    when i run the code ,it exec correctly
    codes:
    Qt Code:
    1. QBuffer* buffer = new QBuffer(this);
    2. buffer->open(QIODevice::ReadWrite);
    3. qint64 bytes = buffer->write(this->readAll());
    4. buffer->seek(buffer->pos() - bytes);
    5. while (buffer->canReadLine())
    6. {
    7. QByteArray line = buffer->readLine();
    8. write(line);
    9. }
    To copy to clipboard, switch view to plain text mode 
    but when i write("xxxxxxx"),or
    Qt Code:
    1. QString s="xxxxxx"
    2. write(s.toLatin1());
    3. write(s.Ascii());
    4. write(s.toLatin1().data());
    5. ..........................
    To copy to clipboard, switch view to plain text mode 

    i can't write successlly,who can help me
    Last edited by jpn; 2nd December 2008 at 18:24. Reason: missing [code] tags

Similar Threads

  1. Reading from sockets in a multithreaded program
    By KoosKoets in forum Qt Programming
    Replies: 9
    Last Post: 4th April 2007, 20:43
  2. saving a c string of variable length in a shared memory?
    By nass in forum General Programming
    Replies: 4
    Last Post: 3rd January 2007, 14:40
  3. How to write on a socket in another thread?
    By Valheru in forum Qt Programming
    Replies: 7
    Last Post: 12th October 2006, 10:52

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.