Skip to content

Instantly share code, notes, and snippets.

@duguying
Last active August 29, 2015 14:12
Show Gist options
  • Save duguying/a02e247ae397a66f4369 to your computer and use it in GitHub Desktop.
Save duguying/a02e247ae397a66f4369 to your computer and use it in GitHub Desktop.
windows上实现打印调试函数dprinf
#include <stdio.h>
#include <stdlib.h>
FILE* dopen(const char* filename){
return fopen(filename,"w");
}
void dprintf(FILE* fd, const char *format,...){
va_list args;
va_start(args,format);
vfprintf(fd,format,args);
va_end(args);
fflush(fd);
}
void dclose(FILE* fd){
if (fd!=NULL){
fclose(fd);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment