dev/c/endian/write_int32.c

24 lines
278 B
C

#include <stdint.h>
#include <stdio.h>
int main (void)
{
int32_t i = 1;
FILE *fid = fopen ("int32.out", "w+");
if (!fid) {
perror ("Failed to open int32.out for write\n");
goto end;
}
fwrite (&i, sizeof (i), 1, fid);
fclose (fid);
end:
return 0;
}