牵着老婆满街逛

严以律己,宽以待人. 三思而后行.
GMail/GTalk: yanglinbo#google.com;
MSN/Email: tx7do#yahoo.com.cn;
QQ: 3 0 3 3 9 6 9 2 0 .

C++判断文件是否存在

#include <fstream>
#incude 
<iostream>

bool bFileExist = false;
std::fstream _file;
_file.open(strFilePath, std::ios::
in);
if (_file)bFileExist = true;
_file.close();

posted on 2007-11-07 11:08 杨粼波 阅读(3234) 评论(2)  编辑 收藏 引用

评论

# re: C++判断文件是否存在 2008-05-08 23:29 dragon

那么判断目录是否存在呢?  回复  更多评论   

# re: C++判断文件是否存在[未登录] 2008-05-09 12:13 杨粼波

bool directoryExist( const std::string& strPath )
{
return ::PathIsDirectory(strPath.c_str()) ? true : false;
}

在Windows下面可以这么做。  回复  更多评论   


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理