All pastes #440988 Raw Edit

Untitled

public cpp v1 · immutable
·published 2007-04-15 12:43 UTC
rendered paste body
#ifndef NO_DEBUGvoid DebugLog(char *pszLogFileName, char *pszOutput, ...){	char szArguments[4096], szBuffer[4096], szDate[32], szTime[32];	va_list va;		GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, "dd/MM/yyyy", szDate, sizeof(szDate));		GetTimeFormat(LOCALE_USER_DEFAULT,				TIME_FORCE24HOURFORMAT,				NULL,				"hh':'mm':'ss",				szTime,				sizeof(szTime));		_snprintf(szBuffer, sizeof(szBuffer) - 1, "%s %s ", szDate, szTime);		va_start(va, pszOutput);		_vsnprintf(szArguments, sizeof(szArguments) - 1, pszOutput, va);		va_end(va);		strncat(szBuffer, szArguments, (sizeof(szBuffer) - strlen(szBuffer)) - 1);		strncat(szBuffer, "\r\n", (sizeof(szBuffer) - strlen(szBuffer)) - 1);#ifndef NO_DEBUGCONSOLE		printf(szBuffer);#endif#ifndef NO_DEBUGDEBUGGER		OutputDebugString(szBuffer);#endif#ifndef NO_DEBUGFILE	FILE *f;		f = fopen(pszLogFileName, a+);	if (f)			fprintf(f, szBuffer);		fclose(f);#endif		return;}#endif