Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

C How does C/C++ store integer in binary file?, Endianness in x86

views
     
flashang
post May 24 2023, 08:52 AM

Casual
***
Junior Member
355 posts

Joined: Aug 2021


QUOTE(Tullamarine @ May 24 2023, 08:40 AM)
It is good to ask questions, not only sharing my limited knowledge.

There are many teachers / sifu here who know better than me. Without asking, I won't know so many know answer to difficult question.

Thanks all.
*
IMHO, most of the info should be able to find from computer architecture theories.

smile.gif


flashang
post Jun 14 2023, 10:02 PM

Casual
***
Junior Member
355 posts

Joined: Aug 2021


QUOTE(KLKS @ Jun 14 2023, 06:04 PM)
an unsigned long long is 8 bytes, where did the 0xC2 come from?
*
This is the result from @tboxmy code :

demointeger.bin (16 bytes)

90 78 56 34 12 00 00 00 90 78 56 34 12 00 00 00

Don't know why (and how) to get the different result.

smile.gif


flashang
post Jun 17 2023, 09:53 AM

Casual
***
Junior Member
355 posts

Joined: Aug 2021


QUOTE(tboxmy @ Jun 16 2023, 06:25 PM)
user posted image

Using the online hex viewer, https://www.scadacore.com/tools/programming...-hex-converter/

Attached is the output, and how that would have shown 0x0000001234567890 in its utf-8 instead of ansi.
Hope that helps.
*
after read carefully, is the format-hex add additional characters.

The first line should be the "original hex" and follow by formatted hex / text.

The demointeger.bin should be 16 bytes.

This online hex viewer show the file content :

HexEd.it - Browser-based Online and Offline Hex Editing
https://hexed.it/

smile.gif



 

Change to:
| Lo-Fi Version
0.0143sec    0.91    6 queries    GZIP Disabled
Time is now: 24th December 2025 - 08:45 AM