从应用程序路径中查找INI文件,并在Compact Framework C#中读取INI文件 [英] Find INI File From application path and Read INI File in Compact framework C#

查看:107
本文介绍了从应用程序路径中查找INI文件,并在Compact Framework C#中读取INI文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好..


我想从应用程序路径中找到Confic.INI文件,我想获取值,我的意思是将INI文件数据读取到字符串中...

我的代码

Hello..


i Want To Find Confic.INI File From Application path and i want get values, i mean read INI file data to string...

My Code

{

  StreamReader Sdr=new StreamReader( System.IO.Path.GetDirectoryName( 
      System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)+"\\Confic.INI")

//HERE I AM NOT GETTING APPLICATION PATH AND FILE NAME)//

String data=file.readline();
}



请帮帮我..

谢谢



Please help me..

Thank You

推荐答案

您要使用此功能:

You want to use this:

Path.GetDirectoryName(Application.ExecutablePath);


String path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase.Replace("file:///", ""))+"\\Confic.INI";
StreamReader Sdr=new StreamReader(path);



使用此方法,让我们知道您所走的路.格式必须错误.您可能会在流阅读器上看到错误.



Use this, and let us know what you get in path. It must be in wrong format. You may get error on stream reader.


这篇关于从应用程序路径中查找INI文件,并在Compact Framework C#中读取INI文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆