路径设置问题
文件 --bin--debug--exe
--A--a.txt
--B--C--c.txt
三个文件夹bin A B 在同一个目录下
用Application.StartupPath取得应用程序exe文件启动的目录路径
比如 string strPath = Application.StartupPath;
我现在要想取得a.txt和c.txt的路径,该怎么取?
外行刚开始接触C#程序,请教
[解决办法]
哦,搞错了,A B Bin同一目录,还得往上返一层
string strPath = Application.StartupPath;
int i=strPath.LastIndexOf("\");
strPath=strPath.Substring(0,i);
i=strPath.LastIndexOf("\");
string strPathA=strPath.Substring(0,i) + "\\A\\a.txt";
string strPathC=strPath.Substring(0,i) + "\\B\\C\\c.txt";