如何取得当前目录
2011-05-25 15:32
239 查看
今天 写项目的时候遇到 一个怪事,除了指定绝对路径(能行,但不灵活),所以想文件就在本目录下,为何还要非得指定一个路径信息呢,于是 经过一翻查找资料,才发现,事情是这样处理~!!
On Windows,
ParamStr(0) returns the path and file name of the executing program (for example, C:/TEST/MYPROG.EXE).
ExtractFilePath(。。。)
The resulting string is the leftmost characters of FileName, up to and including the colon or backslash that separates the path information from the name and extension. The resulting string is empty if FileName contains no drive and directory parts.
///// 当前目录的 表示方法
if tbl2.Active=False then
begin
tbl2.DatabaseName := ExtractFilePath(ParamStr(0)); //+'country.db'
tbl2.Active := True;
end;
On Windows,
ParamStr(0) returns the path and file name of the executing program (for example, C:/TEST/MYPROG.EXE).
ExtractFilePath(。。。)
The resulting string is the leftmost characters of FileName, up to and including the colon or backslash that separates the path information from the name and extension. The resulting string is empty if FileName contains no drive and directory parts.
///// 当前目录的 表示方法
if tbl2.Active=False then
begin
tbl2.DatabaseName := ExtractFilePath(ParamStr(0)); //+'country.db'
tbl2.Active := True;
end;
相关文章推荐
- java如何取得当前目录的路径?
- java如何取得当前目录的路径?
- 如何取得和当前页面联系的MasterPage中的变量
- Clander的用法。如何取得当前时间一个月后/前的时间。如何取得某个月的最后一天。如何取得今年的第一个周一。五月的第二个星期日。如何取得今年的第一周(注意国外的日历和国内可能不一样,如何设置一周开始
- 如何获取程序当前目录
- 如何让linux加载当前目录的动态库
- Linux如何查看当前目录下文件的个数
- 如何在c#中得到当前目录的路径
- 【ARM-Linux开发】C语言getcwd()函数:取得当前的工作目录
- 【C语言】【unix c】如何将当前目录添加到环境变量
- 必须要知道Java如何取得当前路径
- [AHK]如何以当前日期为目录名新建目录
- [VB.NET]请问如何取得多选中的listBox当前选中的文本内容?
- Android编程之如何取得View的当前位置
- C_获得当前的工作路径 _getcwd()函数:取得当前的工作目录(unix c和vc+6.0的都文件的区别)
- ExtJS如何取得GridPanel当前选择行数据对象
- 解决:JS如何取得当前正在执行的function的名字
- 取得当前目录的结构并保存的批处理
- ruby 中如何获取当前的文件名和目录
- java 如何取得程序运行的当前路径