Casting from QByteArray to const BYTE* in a function call
-
Hi,
This is my first post and I haven't seen if this was discussed previously. Apologies if it has and was answered.Using a library that I link into, I have the following signature from the header:
virtual bool DownloadNethraBootLoader(size_t DataSize, const BYTE *Data, PercentUpdate_CB CallBackFunction=NULL, void *Context=NULL);I can manipulate a byte array using the Qt type QByteArray. I need to pass that to the second parameter of the function. Is there a proper conversion or cast that works. I've only been working with Qt 4.8.0 for a few weeks.
Thanks in advance
-
Try using "QByteArray::data ()":http://developer.qt.nokia.com/doc/qt-4.8/qbytearray.html#data and after that convert char* to BYTE*.
-
Thanks Leon for the quick response. I was hoping though for a direct conversion. This may be a bit convoluted. I may be better off dealing with a array of bytes using mem functions etc. I was trying to stay within the Qt class libraries.
-
[quote author="Gerolf" date="1327146217"]More direct then a getter function to access internal data of a class? Depending on the compiler you use, BYTE is a define on char or unsigned char. [/quote]
Yeah I suppose you're right.
Thanks