wagaboy |
09-18-2010 11:54 PM |
Such a thing as C program exit hook ?
I'm writing a library to collect some usage statistics, and it needs to be printed just before the program exists. Is there a way to call a function or a piece of code when the program is about to exit/terminate ? It's ok if the data is not printed during unusual circumstances like program crashes, but I want to print it just before normal termination of the code. Another restriction is that the data should be printed without requiring the library users to call it explicitly.
|