#include <stdio.h>
#include <stdarg.h>
#include "TOOLDebug.h"

static FILE *DebugFile = NULL;

void TDOpen(char *FileName){
	DebugFile = fopen(FileName, "wt");
	TDPrintf("TOOL Debug Reporting\n"); 
}

void TDClose(){
	TDPrintf("END"); 
	fclose(DebugFile);
	DebugFile = NULL;
}

int TDPrintf(char *Format, ...){
   va_list argptr;
   int Count;

   if(!DebugFile) return 0;

   va_start(argptr, Format);
   Count = vfprintf(DebugFile, Format, argptr);
   va_end(argptr);

   return Count;
}
