資源簡介
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.IO;
using?System.Linq;
using?System.Runtime.InteropServices;
using?System.Text;
using?System.Threading.Tasks;
namespace?WindowsFormsApplication1
{
????public?class?iniReadWrite
????{
????????///?
????????///?寫操作
????????///?
????????///?要寫入的段落名
????????///?要寫入的鍵,如果該key存在則覆蓋寫入
????????///?key所對應的值
????????///?INI文件的完整路徑和文件名
????????///?
????????[DllImport(“kernel32“)]
????????public?static?extern?long?WritePrivateProfileString(string?section
????????????????????????????????????????????????????????????string?key?string?val?string?filePath);
????????///?
????????///?讀操作
????????///?
????????///?要讀取的段落名
????????///?要讀取的鍵
????????///?讀取異常的情況下的缺省值
評論
共有 條評論