A little diddy about binary file formats

@APARNA: Thanks!

Hi Romi, unfortunately I’m not that familiar with how structs are laid out on different machines. I assume that they’d be allocated in order [first bytes go to int a; next set of bytes go to int b;] but on a big or little-endian system, the order of the bytes within int a and int b could change.

Cool article. I have a little software business near Redmond, Wa. I was looking up how to recover a corrupted FLA. I don’t recall how I got to this page. The wonders of the internet. Anyway, this was a refreshing little article. Thanks.

Hello

I have a question that is a little bit related with the article, and maybe you have some literature to recommended me about.
I have to write about the problems that this operation:

memcpy(&str1,"\x00\x00\x00\x00\x00\x00\x00\x00",8);
with struct like that, where I know the size but never the concrete fields that will contain, could be arrays, chars or integers:

str1{
int a;
int b;
}
The problem is that it will not be portable into another arquitecture, now I’m in Linux,but I should explain what will happen if I change to use it in another machine. The thing is that i don’t know where to look for explain properly the problem
Maybe you could recommended me where to look because i need to do it in a formal way.
Thanks in advance :slight_smile:

[…] http://betterexplained.com/articles/a-little-diddy-about-binary-file-formats/ […]

After looking over a handful of the blog posts on your
website, I really like your way of blogging. I saved it to my bookmark
site list and will be checking back in the near future.
Please visit my website too and let me know your opinion.

[…] betterexplained.com […]

Hi! Some image software (For my purpose) asking to give binary(8bit) image as input for analysis. but im having only jpg images with me. kindly help me to find out any software’s converting normal images to 8-bit binary image. thanks

Awesome. Very informative. I owe u.