函数可变参数数目(日志)

static char buffer[1024] = {0};

inline void G_Log(const char* message,...)

{

    va_list argp;

    va_start(argp,message);

#ifdef _WIN32

    _vsnprintf ((char*) buffer, sizeof (buffer) / sizeof (char),  

        (const char*)message, argp) ;

#else

    vsnprintf ((char*) buffer, sizeof (buffer) / sizeof (char),  

        (const char*)message, argp) ;

#endif

    va_end(argp);



    //Use buffer

}

 

你可能感兴趣的:(可变参数)