2008-04-15
net 读取ini文件
ServiceConfig.ini
文件内容:
[General]
StationLine=DL1
StationGroup=EMKAU
StationId=EMKAU11
Section=Emilie_Connection
Printer=FinePrint
CultureInfo=zh-TW
[Emilie_Connection]
srvAddress = tcp://172.1.5.2:2103/RoutingObject.Routing
主文件读取.ini文件内容[ DllImport ( "kernel32" ) ]
private static extern int GetPrivateProfileString ( string section ,string key , string def , StringBuilder retVal ,int size , string filePath ) ;
StringBuilder temp = new StringBuilder ( 255 ) ;
GetPrivateProfileString("General", "Section", "", temp, 255, configFilePath);
section = temp.ToString();
GetPrivateProfileString("General", "StationLine", "", temp, 255, configFilePath);
lineID = temp.ToString();
temp.Remove(0, temp.Length);
GetPrivateProfileString("General", "StationGroup", "", temp, 255, configFilePath);
STATION_GROUP_NAME = temp.ToString();
temp.Remove(0, temp.Length);
GetPrivateProfileString("General", "StationId", "", temp, 255, configFilePath);
STATION_ID = temp.ToString();
文件内容:
[General]
StationLine=DL1
StationGroup=EMKAU
StationId=EMKAU11
Section=Emilie_Connection
Printer=FinePrint
CultureInfo=zh-TW
[Emilie_Connection]
srvAddress = tcp://172.1.5.2:2103/RoutingObject.Routing
主文件读取.ini文件内容[ DllImport ( "kernel32" ) ]
private static extern int GetPrivateProfileString ( string section ,string key , string def , StringBuilder retVal ,int size , string filePath ) ;
StringBuilder temp = new StringBuilder ( 255 ) ;
GetPrivateProfileString("General", "Section", "", temp, 255, configFilePath);
section = temp.ToString();
GetPrivateProfileString("General", "StationLine", "", temp, 255, configFilePath);
lineID = temp.ToString();
temp.Remove(0, temp.Length);
GetPrivateProfileString("General", "StationGroup", "", temp, 255, configFilePath);
STATION_GROUP_NAME = temp.ToString();
temp.Remove(0, temp.Length);
GetPrivateProfileString("General", "StationId", "", temp, 255, configFilePath);
STATION_ID = temp.ToString();
发表评论
提醒: 该博客已发表在公共论坛,博客所有留言会成为论坛回贴,留言请注意遵守论坛发贴规则
- 浏览: 4242 次

- 详细资料
搜索本博客
最近加入圈子
最新评论
-
NET判断输入是否为double ...
受教了!谢谢楼主
-- by liuzhenyu170 -
一个截取字符串的方法
呵呵谢谢各位,我是想让他成为一个通用的东西,以后在编写存储过程时,可以直接用,就 ...
-- by 心似海 -
动态SQL
既然是存储过程,当temp_str的值有很多的时候, 可以考虑把temp_str ...
-- by armorking -
一个截取字符串的方法
用函数跑得会比较慢。。。不如再来个表像二楼说的1:N 想了想,写成下面这样貌视 ...
-- by qiuyuanshan -
一个截取字符串的方法
明明A、B两个字段是1:N关系, 用两张主从关系的表来描述,非常轻松 却偏偏要把 ...
-- by armorking






评论排行榜