diff --git a/CHANGELOG.txt b/CHANGELOG.txt index c023b06..af40af3 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,6 @@ +403 +Added logapp. + 402 Added regsettowall command. diff --git a/Main.cpp b/Main.cpp index bf52f60..e36e3b2 100644 --- a/Main.cpp +++ b/Main.cpp @@ -112,6 +112,8 @@ #endif // _MSC_VER #endif // _WIN32 +int UxVCtrl_version = 403; + int main(int argc, char* argv[]) { int i = 0; @@ -215,6 +217,10 @@ int main(int argc, char* argv[]) THREAD_IDENTIFIER MissionArgThreadId; #endif // !DISABLE_MISSIONARG_THREAD CHRONO chrono_GNSS; + FILE* logappfile = NULL; + char logappfilename[MAX_BUF_LEN]; + char* username = NULL; + char hostname[MAX_BUF_LEN]; INIT_DEBUG; @@ -227,9 +233,24 @@ int main(int argc, char* argv[]) srand(GetTickCount()); - printf("\nUxVCtrl V402\n"); + printf("\nUxVCtrl V%d\n", UxVCtrl_version); fflush(stdout); + sprintf(logappfilename, LOG_FOLDER"logapp_%.64s.log", strtimeex_fns()); + logappfile = fopen(logappfilename, "w"); + if (logappfile == NULL) + { + printf("Unable to create log file.\n"); + } + else + { + username = getenv("USERNAME"); + memset(hostname, 0, sizeof(hostname)); + gethostname(hostname, sizeof(hostname)); + fprintf(logappfile, "UxVCtrl V%d (%.255s on %.255s)\n", UxVCtrl_version, username, hostname); + fflush(logappfile); + } + // Will launch a mission file if specified as argument. if (argc == 2) bMissionAtStartup = TRUE; else if (argc > 2) { @@ -712,6 +733,8 @@ int main(int argc, char* argv[]) ReleaseGlobals(); UnloadEnv(); + if (logappfile) fclose(logappfile); + if (ExitCode == EXIT_SUCCESS) { unlink(LOG_FOLDER"CurLbl.txt");