// Or any of: a, ab a+, ab+, w, w+, wb+
FILE* fp = fopen("ww2network.log", "wb") ;
if ( fp != NULL )
fprintf(fp, "Network election: ") ;
... some stuff ...
if ( address )
fprintf(fp, " WINNER: %s\\n"
, addressToStr(address)) ;
fprintf(fp, " *** FAILED: No network\\n") ;
It doesn't leak the file descriptor, I can delete the file while the application continues running… If I take the fclose() out, that breaks. So I know its calling this code. The code works perfectly in debug mode. And as you can see – there is at least one, non-conditional fprintf and the last fprints – well its gotta print one or the other… The obvious "search for some kinda of fprintf macro" produced nothing. Nope. This basic, elementary code just doesn't work. Now – don't get me wrong – there's a simple, proper way to do the above in our client, I'm sure. But our client is a huge, scary monster full of caveats and gotchas. A lot like the hosts, but I know the hosts.