我编了一个程序,其中包括一个图片传送的过程。这个程序在运行的时候,点击图片传送按钮的时候就自动关闭整个程序,显示的结果是terminate called after throwing an instance of 'std::bad_alloc'
what(): St9bad_alloc
不知道这个发是什么原因,我把我的图片传送代码放上去,请各位高手帮我看下,错在哪里
QFile im("123.png");
im.open(IO_ReadOnly);
QDataStream s(&im);
QPixmap str;
s>>str;
QSocketDevice DsrcClientSocket(QSocketDevice::Datagram);
DsrcClientSocket.setBlocking(false);
QByteArray datagram;
QDataStream out(datagram, IO_WriteOnly);
out<<str;
DsrcClientSocket.writeBlock(datagram, datagram.size(),
0x7F000001, 5802);