Hello, today I got a new issue on the program im developing so.. the issue is that I want to change a file in this path C:\Users\[USERNAME]\AppData\Roaming\[PROGRAM NAME].

But the thing is when a user's computer has a different language then english this path changes to something like this C:\[Users in the operating system language]\[USERNAME]\AppData\Roaming\[PROGRAM NAME].


So basically how can I get a file path by doing a "search" if that's possible, or is there any "Master Path" that works for every language..


Hope you guys can help me.

Let Windows handle all that (:

#include <windows.h>
#include <shlobj.h>
#include <iostream>

int main() {
  char appDataPath[MAX_PATH] = { 0 };

  SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, appDataPath);
  std::cout << appDataPath;
}

Really helpful thanks! By the way do you know any site where I can retrieve those codes from? Incase I need to know any other path.

I found a site with the codes just need to know the library to add to the linker 'cause im doing this in VC++.

Thanks in advance.

Found it myself once again. It's Shell32.lib. Thread Solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.