İ started to understanding how binary files works. İ am trying to make a program to get png's width and height. İ followed what wikipedia say's but that didn't work for me. Then i opened a hex editor and relised that the 4 bytes (int) flipped so when i flip them again i get the true value
59 50 4e 47 0d 0a 1a 0a // <- PNG header
00 00 00 0d 49 48 44 52 // 4 bytes for chunk length (13 byte) and 4 byte for chunk name (İHDR)
00 00 03 20 00 00 02 58 //4 bytes for width(800px) and 4 bytes for height(600px)
...
This is what hex editor showing. Like for chunk length it must be 0d 00 00 00 but above its 00 00 00 0d or width its must be 20 03 00 00
İs this normal in binary files? That you need to flip the bytes order to get the true value of int?
This is not just in hex editor. İ flipped the bytes in c++ code to get the value of the integers!