View Single Post
Old 14 October 2018, 11:11   #8
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
Quote:
Originally Posted by phx View Post
Can somebody write an example function with it, like I did in my first post, and test if it works? Does it need "#include <windows.h>" or more?
Code:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

char* get_workdir(void) {
  static char dir[MAX_PATH];
  GetCurrentDirectoryA(MAX_PATH, dir);
  return dir;
}
Works like it should in XP and Windows 10. If it can't convert the characters in the path to the OEM character set, it replaces them with question marks.
Leffmann is offline  
 
Page generated in 0.04394 seconds with 11 queries