Results 1 to 1 of 1

Thread: array of pointers to QtcpSocket

  1. #1
    Join Date
    Feb 2008
    Posts
    36
    Thanks
    4

    Default array of pointers to QtcpSocket

    Sorry for posting this!
    The problem was that I didn't spell QTcpSocket with the large T..
    Regards



    Hi all,

    I want to change my program from connecting to one server to several servers at the the same time. I have declared an array of pointers of type QtcpSocket instead of one pointer.
    Qt Code:
    1. QtcpSocket *tcpSocket[2];
    2.  
    3.  
    4. tcpSocket[0]=new QtcpSocket(this);
    5. tcpSocket[1]=new QtcpSocket(this);
    To copy to clipboard, switch view to plain text mode 
    the code gives the following error-messages:

    error :expected type-specifier before ‘QtcpSocket’.
    error: cannot convert ‘int*’ to ‘QTcpSocket*’ in assignment
    error: expected before ‘;’ before ‘QtcpSocket’
    I have also tried *tcpSocket[0]=new QtcpSocket(this);

    I could declare two QtcpSocket pointers instead, but an array of pointers would be more convenient.
    Thanks, any help is deeply appreciated!

    Regards
    Last edited by marcel; 16th June 2008 at 18:42. Reason: reformatted to look better

Similar Threads

  1. Strange QTcpSocket behavior (debugged with Ethereal)
    By mdecandia in forum Qt Programming
    Replies: 23
    Last Post: 28th May 2007, 20:44
  2. Pointer to a 2D array of pointers ??
    By aamer4yu in forum General Programming
    Replies: 2
    Last Post: 1st February 2007, 11:16
  3. array of pointers to functions
    By moowy in forum General Programming
    Replies: 3
    Last Post: 19th October 2006, 10:48

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.