Skip to content

Instantly share code, notes, and snippets.

@Jacob-Tate
Last active March 5, 2020 09:45
Show Gist options
  • Save Jacob-Tate/14c00152dd7b32497b1e13442afe545c to your computer and use it in GitHub Desktop.
Save Jacob-Tate/14c00152dd7b32497b1e13442afe545c to your computer and use it in GitHub Desktop.
// Assuming unicode
#include <string>
wchar_t path[FILENAME_MAX] = { 0 };
GetModuleFileNameW(nullptr, path, FILENAME_MAX);
std::wstring wide_string(path);
std::string result_string(wide_string.begin(), wide_string.end());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment