hii...
I'm reading file & stroing it in QBYteArray.
The question is :
How can we invert data stored in QByteArray ?
thanks in advanced
hii...
I'm reading file & stroing it in QBYteArray.
The question is :
How can we invert data stored in QByteArray ?
thanks in advanced
If the copying is allowable, one of solution is as follows.
Qt Code:
const int charCount = cstring.count(); qDebug() << cstring; QByteArray invertedCString; invertedCString.resize(charCount); for(int i = 0; i < cstring.count(); ++i) { invertedCString[i] = cstring.at(charCount - 1 - i); } qDebug() << invertedCString;To copy to clipboard, switch view to plain text mode
if your string is multi bytes string, you can use QString instead.
kichi
Qt Code:
for(int i = 0; i < cstring.count(); ++i) {To copy to clipboard, switch view to plain text mode
I'm sorry, I modified the code.
Qt Code:
for(int i = 0; i < charCount; ++i) {To copy to clipboard, switch view to plain text mode
kichi
Bookmarks