精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>编程开发>>C/C++>>文件系统与注册表>>怎样判断一个目录是否存在

主题:怎样判断一个目录是否存在
发信人: hzbbs()
整理人: wenbobo(2002-12-06 23:03:02), 站内信件
不用_chdir

--
※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 199.166.210.65]
发信人: kingfox (老狐狸), 信区: CLanguage
标  题: Re: 请问如何判断一个目录是否存在?
发信站: 网易虚拟社区 (Sun Oct  3 19:54:47 1999), 站内信件

【 在 hzbbs (mizi) 的大作中提到: 】
: 不用_chdir

用DirectoryExists函数。

DirectoryExists:Determines whether a specified directory exists.

Unit

FileCtrl

Category

file management routines

extern PACKAGE bool __fastcall DirectoryExists(const System::AnsiStrin
g Name);

Description

Call DirectoryExists to determine whether the directory specified by t
he Name parameter exists. If the directory exists, the function return
s true. If the directory does not exist, the function returns false.

If a full path name is entered, DirectoryExists searches for the direc
tory along the designated path. Otherwise, the Name parameter is inter
preted as a relative path name from the current directory.


--
------------------------------------------------------------
有缘则聚,缘尽则散,随缘而定,随遇而安。
------------------------------------------------------------
欢迎光临“电子工程师园地”http://kingfox.163.net

※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.101.1.181]
发信人: kingfox (老狐狸), 信区: CLanguage
标  题: Re: 请问如何判断一个目录是否存在?
发信站: 网易虚拟社区 (Sun Oct  3 19:59:01 1999), 站内信件

【 在 hzbbs (mizi) 的大作中提到: 】
: 不用_chdir

还可以用CreateFile函数。

--
------------------------------------------------------------
有缘则聚,缘尽则散,随缘而定,随遇而安。
------------------------------------------------------------
欢迎光临“电子工程师园地”http://kingfox.163.net

※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.101.1.181]
发信人: liudanpao (榴弹炮), 信区: CLanguage
标  题: Re: 请问如何判断一个目录是否存在?
发信站: 网易虚拟社区 (Sun Oct  3 23:00:39 1999), 站内信件

MFC中有个CFileFind类,本地、Internet上的目录和文件都可以查找。

--
※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.96.190.124]

[关闭][返回]