Skip to content

Instantly share code, notes, and snippets.

@wateroot
Created June 13, 2014 03:42
Show Gist options
  • Select an option

  • Save wateroot/c02e577e000429072e24 to your computer and use it in GitHub Desktop.

Select an option

Save wateroot/c02e577e000429072e24 to your computer and use it in GitHub Desktop.
Log2File
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