mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-20 19:02:23 +00:00
Redirect stdout and stderr into files
This commit is contained in:
parent
c0e9a6f045
commit
229e13e6f4
1 changed files with 24 additions and 0 deletions
|
@ -674,6 +674,27 @@ Sys_GetHomeDir(void)
|
|||
return gdir;
|
||||
}
|
||||
|
||||
void
|
||||
Sys_RedirectStdout(void)
|
||||
{
|
||||
char *home;
|
||||
char path_stdout[MAX_OSPATH];
|
||||
char path_stderr[MAX_OSPATH];
|
||||
|
||||
home = Sys_GetHomeDir();
|
||||
|
||||
if (home == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
snprintf(path_stdout, sizeof(path_stdout), "%s/%s", home, "stdout.txt");
|
||||
snprintf(path_stderr, sizeof(path_stderr), "%s/%s", home, "stderr.txt");
|
||||
|
||||
freopen(path_stdout, "w", stdout);
|
||||
freopen(path_stderr, "w", stderr);
|
||||
}
|
||||
|
||||
/* ======================================================================= */
|
||||
|
||||
/*
|
||||
|
@ -697,6 +718,9 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||
/* Make the current instance global */
|
||||
global_hInstance = hInstance;
|
||||
|
||||
/* Redirect stdout and stderr into a file */
|
||||
Sys_RedirectStdout();
|
||||
|
||||
/* Seed PRNG */
|
||||
randk_seed();
|
||||
|
||||
|
|
Loading…
Reference in a new issue