rendered paste bodybool InitializeLogFile(wchar_t *path, wchar_t **log_file)
{
FILE *file;
size_t length = 34+wcslen(path);
*log_file = (wchar_t *) calloc(length, sizeof(wchar_t));
wcscpy_s(*log_file, length, path);
wcscat_s(*log_file, length, L"logs\\");
wchar_t buf[26];
time_t t = time(NULL);
_wctime_s(buf, 26, &t);
buf[24] = 0;
buf[13] = '-';
buf[16] = '-';
wcscat_s(*log_file, length, buf);
wcscat_s(*log_file, length, L".txt");
wprintf(L"logfile %s\n",log_file);
errno_t p = _wfopen_s(&file, *log_file, L"w, ccs=UTF-8");
if ( p != 0 )
{
printf("There was some error and p is not 0 p =%d\n",p);
return false;
}
fclose(file);
return true;
}