Skip to content

Commit

Permalink
Added util/platform module
Browse files Browse the repository at this point in the history
  • Loading branch information
MihailRis committed Nov 9, 2023
1 parent ab7e832 commit 6653472
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/util/platform.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "platform.h"

#ifdef WIN32
#include <Windows.h>

void platform::configure_encoding() {
// set utf-8 encoding to console output
SetConsoleOutputCP(CP_UTF8);
setvbuf(stdout, nullptr, _IOFBF, 1000);
}
#else
void platform::configure_encoding(){
}
#endif
8 changes: 8 additions & 0 deletions src/util/platform.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef UTIL_PLATFORM_H_
#define UTIL_PLATFORM_H_

namespace platform {
extern void configure_encoding();
}

#endif // UTIL_PLATFORM_H_

0 comments on commit 6653472

Please sign in to comment.