One classic way is to read the environment variables using getenv:
char *user = getenv("USER");
char *appdata = getenv("APPDATA");
Regarding user rights and performing file read/write/create in these locations, you certainly can in the user folder the application is running as. In other folders, you'll need to run it as either the target user or administrator. Also, after installing an application in Program Files or Program Files (x86), the system will not allow you to write there. Installations are performed under the 'trustedinstaller' user credentials and the final user rights are set during installation for 'current user' or 'all users'.
Hope this helps.