Click here to Skip to main content
15,887,775 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
quint64 value = 0x000001100021ff00;
quint64 valueTB = qToBigEndian(value);
qDebug()<<QString::number(valueTB,16);


And output is
ff210010010000


why initial byte "00" is trimmed out??

Second is how I can append extra bytes with valueTB.??
Posted
Comments
Richard MacCutchan 10-Dec-15 11:14am    
The first significant digits in the converted value are 0xFF. If you want the leading zeroes displayed then you will need to use a specific format string on the string creator.

 
Share this answer
 
There is no such thing as "00" in primitive-type objects such as integer values. Those leading "00" characters are just characters; they are related to strings representing numbers, and not to numbers themselves. The number 00123 is strictly the same as 123…

Perhaps all you need is simply not to mix up strings representing data with data itself. Maybe you need some more: to learn not to overuse strings. All the work should be done with data, not strings representing data. A string can be needed only as a final result, say, for showing some data on screen. If you need certain format for such string, this is a matter of string formatting, not the operations mentioned in your question.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900