Created
June 13, 2014 03:42
-
-
Save wateroot/c02e577e000429072e24 to your computer and use it in GitHub Desktop.
Log2File
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void Log(const char *pszInfo, ...) | |
| { | |
| va_list args = NULL; | |
| FILE *fp = NULL; | |
| // check if the input param is valid. | |
| if (NULL == pszInfo) { | |
| return; | |
| } | |
| fp = _fsopen("system.tmp", "a+", _SH_DENYNO); | |
| if (NULL == fp) { | |
| return; | |
| } | |
| //format log information. | |
| va_start(args, pszInfo); | |
| (void)vfprintf(fp, (const char *)pszInfo, args); | |
| va_end(args); | |
| (void)fclose(fp); | |
| return; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment