Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

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

views
     
MatQuasar
post Jun 17 2023, 02:10 PM

Casual
***
Validating
329 posts

Joined: Jun 2023
QUOTE(tboxmy @ Jun 16 2023, 06:25 PM)
Using the online hex viewer,

Attached is the output, and how that would have shown 0x0000001234567890 in its utf-8 instead of ansi.
Hope that helps.
*
Yes, I get it. According to this Ascii UTF-8 table: https :// kellykjones.tripod.com/webtools/ascii_utf8_table.html

0x90 is becoming 0xC2 0x90
0xFF is becoming 0xC3 0xBF

But anything below 0x80 (0x00 ~ 0x7F) is still one byte original value.


WongGei
post Jun 30 2023, 10:40 PM

Regular
******
Senior Member
1,206 posts

Joined: Dec 2007
From: Kuala Lumpur
Input output library is not part of the standard, or independent from the C language. Each system and platform are free to implement thier own way.
As some already pointed out, the way data stored is depends on Endian , and also the size of the variable. 16bits, 32bits and 64bits platform will have different result.

 

Change to:
| Lo-Fi Version
0.0120sec    0.46    5 queries    GZIP Disabled
Time is now: 24th December 2025 - 07:17 AM