Jump to content
  • Advertisement
Sign in to follow this  
gretty

Find App Data Folder on Different Windows Versions

This topic is 3054 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!