Hot to express "Int16[] myInt16Array = new Int16[5];" in Qt?
-
C# Code:
Int16[] myInt16Array = new Int16[5];Hot to express the code in Qt?
-
-
@SGaist
Thanks.
I thought you mean the two way:Method 1:
QList<qint16> myInt16Array;Method 2:
qint8 *myInt16Array;
myInt16Array=new qint8[5]; -
@SGaist
Q1:
If my C# code look like below:byte[] mybyte = { }; if (bWriteBmp) { Bitmap mybmp = this.DrawBitmap(myFile, 75, 65);//<----my function if (mybmp!= null) { MemoryStream ms = new MemoryStream(); mybmp.Save(ms, ImageFormat.Bmp); mybyte = ms.ToArray(); } }
Hot to express the code in Qt?
Q2:
my C# code:
myCheck = BitConverter.GetBytes(myValue);Could I alway use the below code in Qt for any types of "myCheck"?
(ex. set qint16 "myCheck" or set qint32 "myCheck" or set int "myCheck")
myCheck = QByteArray::fromRawData((const char *)&myValue, sizeof(myValue)); -
@mkdh You're asking to translate a C# code in C++/Qt. I suggest to study the C++ language and then move to Qt.
In your case you can find very useful the
QByteArray
class.