Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Saving a file to Application Data in c#

I used the following method to save a file to the folder Application Data in c#

string path = 
    Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

Its working fine in windows XP, but i cannt find such a folder path i Windows vista. Where is this folder located in Vista and how can i save the file to this folder

like image 529
raki Avatar asked Oct 15 '09 13:10

raki


People also ask

How do I save a file in C?

Press ctrl+f on the keyboard to open file menu. Scroll down to save the option of the file menu using the down arrow key of the keyboard and press enter. This will open the save file dialog box. Pressing F2 key on the keyboard will also open the save file dialog box of the Turbo C.

What is application data file?

The application data folder is a special hidden folder that your app can use to store application-specific data, such as configuration files. The application data folder is automatically created when you attempt to create a file in it. Use this folder to store any files that the user shouldn't directly interact with.

Why do we need to store data in file in C?

Why files are needed? When a program is terminated, the entire data is lost. Storing in a file will preserve your data even if the program terminates. If you have to enter a large number of data, it will take a lot of time to enter them all.


1 Answers

This should work out the folder for you in the background. Do you mean you don't know exactly where the file has been saved to?

In Vista if you go to Run and type %APPDATA% that should bring up the Application Data folder and your file should be in there.

The path is essentially

C:\Users\Username\AppData\Roaming
like image 192
James Avatar answered Sep 27 '22 21:09

James