Sign in to follow this  
gretty

Find App Data Folder on Different Windows Versions

Recommended Posts

gretty    273
Hello I am writting a C++ Win32 program that records the last file directory opened & writes it to a text file in the computers Application Data folder. But I have been looking in to it & it seems like the directory path for the Application Folder is different for different versions of windows. For example; In Vista the path is something like "C://users/Jack/APPDATA" (I think) but in XP its different I dont remember what. So I guess my question is; how can I make my program find where the Application Data folder is to write & save my text file & how can I make it so that my program will be able to do this over all windows versions?

Share this post


Link to post
Share on other sites
Nypyren    12061
You should be able to use the %APPDATA% environment variable as part of your path string. I'm not sure whether all of the File I/O APIs accept that or not but it's worth a shot.

If that doesn't work, you should be able to get the appdata path by using the GetEnvironmentVariable function first, then appending your relative file path to that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this