【发布时间】:2011-05-04 07:53:36
【问题描述】:
我们能否通过 QTcpSocket 套接字将包含指向另一个结构的指针的结构发送到在其他物理位置运行的程序的 QTcpServer 套接字,然后是这个程序。我的代码会是这样的......
<i>
QTcpSocket tcpSocket = new QTcpSocket(this);
Struct a{ int a1; int a2;} __attribute__((packed));
Struct b { int b1; int b2}__attribute__((packed));
Struct c{ a *c1; a*c2; }QByteArray block;
QDataStream out(&block, QIODevice::WriteOnly);
out << quint16(0)<<c;
out << quint16(block.size() - sizeof(quint16));
tcpSocket->write(block);
</i>
但这有如下错误: /TcpClient-build-desktop/../TcpClient/tcpclient.cpp:137:错误:'out.QDataStream::operator中的'operator
【问题讨论】:
标签: qt