I want to access the user name in the Windows using C programming and use that name to create the path to the particular file like \"c:\\users\\john\\Roaming.....and so on\"
#include int main(void) { printf("%s\n", getenv("USERPROFILE")); // Print user's home directory. return 0; }
To get the user name instead of the home path replace USERPROFILE with USERNAME.
USERPROFILE
USERNAME