C macro notes
★ WinCE 上 debug (沒有console, 只能寫檔看訊息)
#ifdef _WSOCK_DEBUG_
#define W_FOPEN(args) FILE *wsock_pFile;\
wsock_pFile = fopen args;
#define W_PRINT(str, ...) { fprintf(wsock_pFile, str,__VA_ARGS__); }
#define W_FCLOSE() fclose(wsock_pFile);
#else
#define W_FOPEN(args) { }
#define W_PRINT(str, ...) { }
#define W_FCLOSE() { }
#endif
☆ ---使用方式---
W_FOPEN( ("My Documents/test_lib.htm","w+") ) //W_FOPEN()裡頭一定要再加括號
W_PRINT("%s:%d", "test", 2 )
W_PRINT("\nthe end\n" )
W_FCLOSE()
This entry was posted
on 2009年11月11日 星期三
at 中午12:26
and is filed under
C language
. You can follow any responses to this entry through the
comments feed
.