#include "stdafx.h"
#include <stdarg.h>
#include <iostream>
using namespace std;

static inline void hlogv(const char *format, va_list args)
{
char message[1024] = "";
int num = _vsprintf_p(message, 1024, format, args);
freopen("log.txt","w",stdout);
cout<<message<<endl;
freopen("CON", "w", stdout);
cout<<message<<endl;
}

void hlog(const char *format, ...)
{
va_list args;

va_start(args, format);
hlogv(format, args);
va_end(args);
}

int _tmain(int argc, _TCHAR* argv[])
{

int k = 4;
char s[] = "111";
hlog(".%s..%d..",s,k);
getchar();
return 0;
}

 

posted on 2018-02-02 16:49  朽木の半夏  阅读(99)  评论(0编辑  收藏  举报