[Qt-interest] adding zero to QByteArray
Parker
userqt at gmail.com
Thu May 28 13:27:20 CEST 2009
I see. Thank you.
----- Original Message -----
From: "Thomas Dähling" <t.daehling at googlemail.com>
To: "Qt Interest List" <qt-interest at trolltech.com>
Sent: Thursday, May 28, 2009 2:15 PM
Subject: Re: [Qt-interest] adding zero to QByteArray
static_cast is your friend in such situations. The compiler complains
about ambiguity, just force the value to be treated as char by casting
it...
/Thomas
2009/5/28 Parker <userqt at gmail.com>:
> Hello all,
> I have another small newbie question here.
>
> I'm trying to add a integer zero value to QByteArray .
>
> QByteArray datagram;
> datagram.push_front(0x0);
>
> datagram.push_front(0x1);
>
>
>
> But the first call generates an error. It seems it thinks 0 could be a
> null
> pointer ot something ? Any ideas how to put 0 in it ?
>
> I have to send some bytes trought the wire with UDP here.
>
>
>
>
> snmpsession.cpp: In member function `int
> SNMPSession::sendSetRequest(QByteArray&, QByteArray&, int)':
>
> snmpsession.cpp:77: error: call of overloaded `push_front(int)' is
> ambiguous
>
> d:/Qt/2009.02/qt/include/QtCore/../../src/corelib/tools/qbytearray.h:492:
> note: candidates are: void QByteArray::push_front(char)
>
> d:/Qt/2009.02/qt/include/QtCore/../../src/corelib/tools/qbytearray.h:494:
> note: void QByteArray::push_front(const char*)
>
> d:/Qt/2009.02/qt/include/QtCore/../../src/corelib/tools/qbytearray.h:496:
> note: void QByteArray::push_front(const QByteArray&)
>
> snmpsession.cpp:81: error: call of overloaded `push_front(int)' is
> ambiguous
>
> d:/Qt/2009.02/qt/include/QtCore/../../src/corelib/tools/qbytearray.h:492:
> note: candidates are: void QByteArray::push_front(char)
>
> d:/Qt/2009.02/qt/include/QtCore/../../src/corelib/tools/qbytearray.h:494:
> note: void QByteArray::push_front(const char*)
>
> d:/Qt/2009.02/qt/include/QtCore/../../src/corelib/tools/qbytearray.h:496:
> note: void QByteArray::push_front(const QByteArray&)
>
> snmpsession.cpp: In member function `void
> SNMPSession::convertOidAccordingToBER(QByteArray&)':
>
> snmpsession.cpp:121: warning: unused variable 'intValue'
>
> mingw32-make.exe[1]: *** [debug/snmpsession.o] Error 1
>
> D:\Qt\2009.02\mingw\bin\mingw32-make.exe: *** [debug] Error 2
>
> Exited with code 2.
>
> Error while building project DigiIP
>
> When executing build step 'Make'
>
> __________ 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-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
__________ 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
More information about the Qt-interest-old
mailing list