Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
hi i am using visual studio 2008 and developing an application in C++/CLI. My application does some file IO. the directory structure is as follows

"C:\Program Files\AppName\Data\settings.dat"

im working on my laptop with windows vista. the programm does not allow me to create or read the file "settings.dat"
whereas it allows me to read/write the files which are further down the directory structure. for example

"C:\Program Files\AppName\Data\Folder\2010\file.dat"
this above file is accessible.

i think it has got something to do with file access permissions. is there any way to side-step it programmatically?
can anyone please tell me what the problem is and how i will be able to fix it?

thank you very much
Posted

1 solution

Vista doesn't allow you to make changes to any folder in the Program Files folder. You have to use one of the special folders for Vista and later.

Google this and pick your poison from the returned results set:

"C++ vista special folders"

EDIT -------

You can make your setup program create the appropriate folder and copy files to it. Most/all setup building programs allow you to configure this.
 
Share this answer
 
v2
Comments
Archman420 23-Aug-10 14:10pm    
the thing is i am making a setup of my application. so is it that i cant install the application to any of the folders listed in this result set?
Archman420 23-Aug-10 14:15pm    
also the problem is that i create the settings file during runtime
Archman420 25-Aug-10 2:51am    
thanks John that solved my problem

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900