3C科技 娛樂遊戲 美食旅遊 時尚美妝 親子育兒 生活休閒 金融理財 健康運動 寰宇綜合

Zi 字媒體

2017-07-25T20:27:27+00:00
加入好友
C/C++(CodeBlocks) 開發DLL專案 必用Log File(記錄檔) 產生器   由於最近再使用C/C++(CodeBlocks) 開發DLL專案,發現沒有GUI顯示實在無法得知程式運作狀態,因此撰寫該函數方便記錄使用,現在貼出來和同好分享。   //— #define LogFile “WCardLib.log” static int g_intDebug;//設成1就代表為DEBUG模式,該函數才會作用 void WriteLog(const char *Msg,int state) {     if(g_intDebug==1)     {         FILE *pf=’\0′;         if(state==1)//將先前紀錄清除         {             pf=fopen(LogFile,”w”);         }         else//接續先前紀錄,繼續接續         {             pf=fopen(LogFile,”a”);         }         fprintf(pf,Msg);         fprintf(pf, “\n”);         fclose(pf);     } }      

本文由jashliaoeuwordpress提供 原文連結

寫了 5860316篇文章,獲得 23313次喜歡
精彩推薦