View Full Version : array of pointers to QtcpSocket

16th June 2008, 09:15
Sorry for posting this!
The problem was that I didn't spell QTcpSocket with the large T..

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.

QtcpSocket *tcpSocket[2];

tcpSocket[0]=new QtcpSocket(this);
tcpSocket[1]=new QtcpSocket(this);

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!