宏的一种用途

    技术2022-06-24  45

    定义:

    FILE *DebugLogFile = NULL; #define DebugLog(n,f) (void)((DebugLogFile != NULL && nDebugLevel & n) ? (_ftprintf f,fflush(DebugLogFile)) : 0)

    使用:

    DebugLog(1,(DebugLogFile,"ImeProcessKey/n"));

     

    宏展开,把f用(DebugLogFile,"ImeProcessKey/n")代替,即是:

    _ftprintf(DebugLogFile,"ImeProcessKey/n")

    fflush(DebugLogFile);

     

    等于调用了这两个函数


    最新回复(0)