Hal Vaughan wrote:
> Richard Heathfield wrote:
>
>> Hal Vaughan said:
>>
>>> I have a series of codes that will include NULL bytes
>> Shhhhh, we're trying to sleep... NULL is a pointer. You mean null
bytes,
>> right? i.e. '\0' rather than ((void *)0)
>
> My bad.
But not too bad: It's just, that NULL has a well defined meaning in C.
>> unsigned char buf[8] = { 0x00, 0x9E, 0x3A, 0x00, 0x00, 0x5F, 0xCD, 0xFE
};
>> fwrite(buf, sizeof buf / sizeof buf[0], sizeof buf[0], fp);
>
> Okay, got it. Just to be sure, fp is filepointer, the same as an int
file
> descriptor, right?
Wrong! File descriptors are original K&R C. To get the most fun out of
them, use them without function prototypes.
For us cowards, C89 introduced a new type FILE* and a new set of
functions, which were more comfortable and much safer. (fopen, fread,
fgetc...).
-- ralph


|