Hal Vaughan said:
> Richard Heathfield wrote:
>
<snip>
>>
>> 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,
Yes, a FILE *
> the same as an int file descriptor, right?
Er, well, it does a similar kind of job, sort of.
FILE *fp = fopen(filename, "wb");
if(fp != NULL)
{
fwrite calls go here
if(ferror(fp))
{
/* something screwy somewhere */
}
if(fclose(fp))
{
/* something went wrong while
closing the file! Yes, this can happen...
*/
}
}
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www.
+rjh@[EMAIL PROTECTED]
users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999


|