summaryrefslogtreecommitdiffhomepage
path: root/FoundationEx
diff options
context:
space:
mode:
Diffstat (limited to 'FoundationEx')
-rw-r--r--FoundationEx/CMakeLists.txt1
-rw-r--r--FoundationEx/Utils.cpp39
-rw-r--r--FoundationEx/Utils.h17
3 files changed, 57 insertions, 0 deletions
diff --git a/FoundationEx/CMakeLists.txt b/FoundationEx/CMakeLists.txt
index 8672619..c2b546b 100644
--- a/FoundationEx/CMakeLists.txt
+++ b/FoundationEx/CMakeLists.txt
@@ -4,6 +4,7 @@ add_library(
STATIC
MemDebug.cpp
Text.cpp
+ Utils.cpp
)
target_include_directories(
FoundationEx
diff --git a/FoundationEx/Utils.cpp b/FoundationEx/Utils.cpp
new file mode 100644
index 0000000..8a9f157
--- /dev/null
+++ b/FoundationEx/Utils.cpp
@@ -0,0 +1,39 @@
+/* Starshatter: The Open Source Project
+ Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors
+ Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
+ Copyright (c) 1997-2006, Destroyer Studios LLC.
+*/
+
+#include <stdarg.h>
+#include <stdio.h>
+
+
+FILE* ErrLog = nullptr;
+
+
+void AssignErrLog(FILE * out)
+{
+ ErrLog = out;
+}
+
+
+int CloseErrLog()
+{
+ if (ErrLog)
+ return fclose(Errlog);
+ return 0;
+}
+
+
+void Print(const char* fmt, ...)
+{
+ if (!ErrLog) return;
+ va_list args;
+ va_start(args, fmt);
+ vfprintf_s(ErrLog, fmt, args);
+ fflush(ErrLog);
+ va_end(args);
+}
+
+
+#endif // Utils_h
diff --git a/FoundationEx/Utils.h b/FoundationEx/Utils.h
new file mode 100644
index 0000000..da7b66d
--- /dev/null
+++ b/FoundationEx/Utils.h
@@ -0,0 +1,17 @@
+/* Starshatter: The Open Source Project
+ Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors
+ Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
+ Copyright (c) 1997-2006, Destroyer Studios LLC.
+*/
+
+#ifndef Utils_h
+#define Utils_h
+
+#include <stdio.h>
+
+
+void AssignErrLog(FILE * out);
+void CloseErrLog();
+void Print(const char* fmt, ...);
+
+#endif // Utils_h