arrays - Merging two index into one index in QByteArray in QT -


i have qbytearray contains data below:

[0] --> [1] --> b [2] --> c [3] --> d 

i want below:

[0] --> ab [1] --> cd 

is possible. how can it. thanks

there many ways of doing this. can't directly use qbytearray achieve want each index stores 1 byte.

one solution let each index in vector correspond qbytearray (including merge):

qbytearray bytearray("abcdefg"); qvector<qbytearray> vectorbytearray; (auto = 0; < bytearray.size(); += 2) {   vectorbytearray << qbytearray(bytearray.constdata() + i, (i + 1 == bytearray.size()) ? 1 : 2); }  (auto & element : vectorbytearray) {   qdebug() << element.constdata(); } 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -