I\'m working on some code that generates a lot of
ignoring return value of ‘size_t fwrite(const void*, size_t, size_t, FILE*)’, declared with attribute warn
Your first solution looks ok. Usually a goto err; comes in more handy as you may need some common cleanup part (such as rewinding to a known position).
goto err;
To make GCC quiet just do:
(void)fwrite (&blah, sizeof (blah), 1, fp); (void)fwrite (&foo, sizeof (foo), 1, fp);