开发者

Convert double array to QByteArray

开发者 https://www.devze.com 2023-03-12 01:02 出处:网络
What is the best way to convert a double array (double*) to a QByteArray ? I have the size of the array.

What is the best way to convert a double array (double*) to a QByteArray ?

I have the size of the array. I thought of converting each double to a QByteArray and then append all the arrays to a big QByteArray.

For the other way, well maybe parse the data to many QByteArrays (one for each double) and convert them to double.

I don't know which QByteArray metho开发者_开发技巧d to use for an efficient parsing ?

Thanks


If you have double* da and size of that array s you may use the following:

QByteArray::fromRawData(reinterpret_cast<const char*>(da),s*sizeof(double))
0

精彩评论

暂无评论...
验证码 换一张
取 消