本文整理汇总了C++中FILE::fail方法的典型用法代码示例。如果您正苦于以下问题:C++ FILE::fail方法的具体用法?C++ FILE::fail怎么用?C++ FILE::fail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FILE
的用法示例。
在下文中一共展示了FILE::fail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: zppError
// ctor: input is filename to open.
// only std::ios::in is supported currently.
// if _makeGlobal == TRUE, then the ZipFile is added to the list
// of global zip files.
zppZipArchive::zppZipArchive(const std::string &_fn, std::ios::openmode _mode, bool _makeGlobal)
{
ourFile = false;
zipName = _fn;
canonizePath(zipName);
#ifdef ZPP_INCLUDE_CRYPT
passwd = NULL;
#endif
if (_mode & std::ios_base::in) {
// make sure "binary" mode is selected.
_mode |= std::ios_base::binary;
#ifdef ZPP_USE_STDIO
FILE *infile = fopen(zipName.c_str(),"rb");
current_pos_v=0;
#else
std::ifstream *infile = new std::ifstream();
infile->open(zipName.c_str(),_mode);
#endif
ourFile = true;
#ifdef ZPP_USE_STDIO
if (!infile)
throw zppError("can't open zip file");
#else
if (infile->fail())
throw zppError("can't open zip file");
#endif
str = infile;
} else {
throw ("zppZipArchive:: only std::ios::in currently supported.");
}
priority = defaultPriority;
isGlobal = _makeGlobal;
// build internal data structures
parseZipDirectory();
}