读取ini配置文件
来源:互联网 发布:手机景点讲解器软件 编辑:程序博客网 时间:2024/06/05 08:50
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Commonresource
{
public class ReadINI
{
[DllImport("kernel32")]//返回取得字符串缓冲区的长度
private static extern long GetPrivateProfileString(string section, string key,
string def, StringBuilder retVal, int size, string filePath);
public static string ReadIni(string Section, string Key, string NoText, string iniFilePath)
{
if (File.Exists(iniFilePath))
{
StringBuilder temp = new StringBuilder(1024);
GetPrivateProfileString(Section, Key, NoText, temp, 1024, iniFilePath);
return temp.ToString();
}
else
{
return String.Empty;
}
}
}
}
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Commonresource
{
public class ReadINI
{
[DllImport("kernel32")]//返回取得字符串缓冲区的长度
private static extern long GetPrivateProfileString(string section, string key,
string def, StringBuilder retVal, int size, string filePath);
public static string ReadIni(string Section, string Key, string NoText, string iniFilePath)
{
if (File.Exists(iniFilePath))
{
StringBuilder temp = new StringBuilder(1024);
GetPrivateProfileString(Section, Key, NoText, temp, 1024, iniFilePath);
return temp.ToString();
}
else
{
return String.Empty;
}
}
}
}
阅读全文
0 0
- VC读取配置文件(.ini)
- C#读取ini配置文件
- ini配置文件读取类
- C# 读取ini配置文件
- Python读取ini配置文件
- 批处理读取ini配置文件
- GetPrivateProfileString读取配置文件(.ini)
- 读取ini配置文件
- 读取配置文件Ini文件
- Qt读取ini配置文件
- MFC 读取配置文件ini
- Python读取ini配置文件
- C++读取.ini配置文件
- C# 读取ini配置文件
- C# 读取ini配置文件
- Qt读取ini配置文件
- C++读取INI配置文件
- C# 读取ini配置文件
- UBIFS文件系统简介 与 利用mkfs.ubifs和ubinize两个工具制作UBI镜像
- vue中引入jQuery
- VirtualBox网络配置
- [Kubernetes] CentOS 7 Etcd 集群部署教程
- ngx.req和get/post参数获取
- 读取ini配置文件
- bootstrap 自适应全屏轮播可支持左右滑动
- spring Ioc底层原理
- NOIP 2011 题解+代码
- Qt的信号与槽机制理解
- JDBC连接数据库(statement)
- 入it行感悟
- ZOJ 3988 && 2017CCPC秦皇岛 H:Prime Set(二分匹配)
- Spring + Activiti + Drools整合的请假例子