C # read and write configuration files

xiaoxiao2021-03-06  29

C # read and write profile Using system; use system.Runtime.InteropServices; use system.text;

Namespace Mp3Manager.commm {///

/// rwini summary description. /// public class rwini {[DLLIMPORT ("kernel32")] private statino (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);

/ / Write the function of the INI file PUBLIC VOID INIWRITEVALUE (String section, String Key, String, String FilePath) {WritePrivateProfileString (Section, Key, Value, FilePath);} / / Function for read operations for INI files PUBLIC string IniReadValue (string Section, string Key, string filepath) {StringBuilder sbTemp = new StringBuilder (255); int i = GetPrivateProfileString (Section, Key, "", sbTemp, 255, filepath); return sbTemp.ToString ();} public Rwini () {// // Todo: Add constructor logic //}}}}} here

转载请注明原文地址:https://www.9cbs.com/read-57768.html

New Post(0)