Ah, yes. It's automatecaly converting the QByteArray into normal array first. I should get use to the documentation... :)
----- Original Message ----- From: "Andre Poenitz" <[email protected]> To: <[email protected]> Sent: Sunday, May 24, 2009 6:36 PM Subject: Re: [Qt-creator] Regarding QByteArray > On Sun, May 24, 2009 at 06:29:39PM +0300, Kosta wrote: >> Hello, Does anyone know how to remove the \0 character from the end my >> this array ? > > You do not have to do that. >> >> Although the size() is 5, the byte array also maintains an extra '\0' >> character at the end so that if a function is used that asks for a >> pointer to the underlying data (e.g. a call to data()), the data >> pointed to is guaranteed to be '\0'-terminated. >> >> I have to send some bytes trought the wire and I think this \0 will >> cause a problem if I send it. I'm using UDP, so I will use the >> writeDatagram method of QUdpSocket. Actually I'm sending SNMP >> message. > > It's > > QUdpSocket::writeDatagram(const char *data, qint64 size, const > QHostAddress &address, quint16 port) > > so > > writeDatagram(ba, ba.size(), address, port) > > should just work. > > Andre' > _______________________________________________ > Qt-creator mailing list > [email protected] > http://lists.trolltech.com/mailman/listinfo/qt-creator > > > __________ Information from ESET NOD32 Antivirus, version of virus > signature database 4098 (20090522) __________ > > The message was checked by ESET NOD32 Antivirus. > > http://www.eset.com > > > __________ Information from ESET NOD32 Antivirus, version of virus signature database 4098 (20090522) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com _______________________________________________ Qt-creator mailing list [email protected] http://lists.trolltech.com/mailman/listinfo/qt-creator
