Created
March 2, 2012 18:37
-
-
Save ariya/1960277 to your computer and use it in GitHub Desktop.
simple logging to file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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