Beispiel #1
0
void put_16_be(uint16_t value, FILE *outfile)
{
    unsigned char buf[2];
    write_16_be(value, buf);
    size_t bytes_written = fwrite(buf, 1, 2, outfile);
    CHECK_FILE(bytes_written != 2, outfile, "fwrite");
}
Beispiel #2
0
void put_16_le(uint16_t value, FILE *infile)
{
    unsigned char bufTemp[2], buf[2];
    write_16_be(value, bufTemp);
	for (int i = 0; i < 2; i++)
		buf[1-i] = bufTemp[i];
    size_t bytes_written = fwrite(buf, 1, 2, infile);
    CHECK_FILE(bytes_written != 2, infile, "fwrite");
}