void LogError(char const *fmt, ...) { char buf[2148]; va_list args; va_start(args, fmt); if (curLogFile != NULL) { fprintf(curLogFile, "%s", Timestamp()); vfprintf(curLogFile, fmt, args); } else { strcpy(buf, "No log file: "); vsnprintf(buf + strlen(buf), 2048, fmt, args); buf[2147] = 0; ::OutputDebugStringA(buf); } // add the message to the window vsnprintf(buf, 2048, fmt, args); buf[2147] = 0; AddErrorText(buf); va_end(args); }