Skip to content

Commit 1ff90af

Browse files
author
Tal Hadad
committed
fix: windows string conversion again
1 parent 1b6d1a8 commit 1ff90af

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

simplecpp.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
#include <vector>
4242

4343
#ifdef SIMPLECPP_WINDOWS
44-
#include <atlconv.h>
4544
#include <windows.h>
4645
#undef ERROR
4746
#else
@@ -2689,7 +2688,9 @@ static std::string currentDirectoryOSCalc() {
26892688
#ifdef SIMPLECPP_WINDOWS
26902689
TCHAR NPath[MAX_PATH];
26912690
GetCurrentDirectory(MAX_PATH, NPath);
2692-
CW2A NPathA(NPath);
2691+
// convert the result from TCHAR* to char*
2692+
char NPathA[MAX_PATH];
2693+
::WideCharToMultiByte(CP_ACP, 0, NPath, lstrlen(NPath), NPathA, MAX_PATH, NULL, NULL);
26932694
return NPathA;
26942695
#else
26952696
const std::size_t size = 1024;

0 commit comments

Comments
 (0)