I wrote this small C program:
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE * fp;
fp = fopen("data.txt","w");
fprintf(fp,"%d",578);
return 0;
}
Then I analyzed data.txt using xxd -b. I was expecting that I will see the 32 bit representation of 578 instead I saw the ASCII representation of 578:
xxd -b data.txt
0000000: 00110101 00110111 00111000 578
Why is that? How do I store the 32 bit representation of 578 (01000010 00000010 00000000 00000000) assuming little endian?
Use
fwrite:fprintfis for formatted output, whence the trailingf.