Skip to content

Instantly share code, notes, and snippets.

@ariya
Created March 2, 2012 18:37
Show Gist options
  • Save ariya/1960277 to your computer and use it in GitHub Desktop.
Save ariya/1960277 to your computer and use it in GitHub Desktop.
simple logging to file
#include <stdarg.h>
#include <stdio.h>
static void log( char* string, ... )
{
va_list parameter;
char output[256];
FILE *f;
va_start( parameter, string );
vsnprintf( output, 255, string, parameter );
f = fopen( "output.log", "at" );
fprintf( f, "%s\n", output );
fclose( f );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment