There is a function that terminates the program by filling in debug information in the log file:
void crash(const char *const _fstr, ...) { if ( (_fstr != NULL) && (strlen(_fstr) > 0) ) { FILE *f = fopen(CRASH_LOG_FILE_NAME, "a"); fprintf(f, _fstr, ???); fclose(f); } abort(); } I want to ensure that the format string and some number of arguments are passed to the crash() function. Situations are different. For some crashes, it is desirable to add not only a line describing the problem, but also a series of codes, for example, GetLastError() and WSAGetLastError() .
How to do it?