Where to store ini files, log files for an application?

Where should I be storing any ini files and log files that my application creates and uses?  I've been storing them right in the program's directory under Program Files which I realize now is not optimal - but works until users start using Vista.

So, where should I be storing them so that it will work on Vista and other versions of Windows?  Should the program create a folder in this place or should I have the install program do it?
davemabe2000Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

b0lsc0ttIT ManagerCommented:
davemabe2000,

You could have your program use the %APPDATA% environment variable to access the AppData folder that is in the User's folder (e.g. c:\Documents and Settings\User\Application Data\).  That variable should work in any OS Windows 2000 and after.  Create your own folder in that folder and store your INI files in it.

Let me know if you have any questions or need more information.

b0lsc0tt
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Pretzel_JesusCommented:
Actually you never put in a path to the files it uses whatever folder they are currently in, vista or otherwise. So things like:

StreamReader sr = new StreamReader("settings.ini");

would read data right from the root folder, regardless of where it is. This works for any OS.
0
b0lsc0ttIT ManagerCommented:
I'm glad I could help.  I am curious about the B grade though.  Since you never posted a response it would seem my comment was all you needed for an answer.  If that is the case this is complete and should get an A grade.  Please let me know how this turned out and why the grade.  If a mistake was made or you have a question about what grades mean here then let me know.
Thanks for the fun question.
bol
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.