Click here to Skip to main content
15,885,956 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
can any one know about this plz help me
Posted

 
Share this answer
 
.INI files are somewhat out of date - they stopped being the recommended way of doing things with Windows 95, and that was nearly twenty years ago! :laugh:
However, if you must...
You can use the Windows methods which will still work:
C#
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section, string key,string val,string filePath);
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section, string key,string def, StringBuilder retVal, int size,string filePath);

Then to write:
C#
WritePrivateProfileString("Section","Key","Value",pathToINIFile);

And read:
C#
StringBuilder result = new StringBuilder(255);
int i = GetPrivateProfileString("Section", "Key", "Default", result, 255, pathToIINIFile);
string value = result.ToString();
 
Share this answer
 
 
Share this answer
 

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