Hacker News new | ask | show | jobs
by w0000t 3960 days ago
That sort of thing is actually a completely valid approach.

You made a small mistake, since fprintf and printf call the same underlying code, the error handling should be either log the error in any way still available, and then depending on the design of the whole program, exit or continue. If printf fails you know exactly what is going on or have to exit. ( And printf would be wrapped in a function if you plan to use it repeatedly. )