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
Something like this would work
if (fwrite (&blah, sizeof (blah), 1, fp) != 1) throw SomeException;
If you're worried about pointers being cleaned up you can wrap the pointer in some form of smart pointer before carrying out your fwrite's.
If you don't want to use smart pointers then this will work, but it's messy, so I'd try the smart pointer route first
if (fwrite (&blah, sizeof (blah), 1, fp) != 1) {
//cleanup here
throw SomeException;
}