您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ unzLocateFile函数代码示例

51自学网 2021-06-03 09:12:38
  C++
这篇教程C++ unzLocateFile函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中unzLocateFile函数的典型用法代码示例。如果您正苦于以下问题:C++ unzLocateFile函数的具体用法?C++ unzLocateFile怎么用?C++ unzLocateFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了unzLocateFile函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: unz_exists

int	unz_exists(const char *filename){	if (unzLocateFile(gamezip, filename, 1) == UNZ_OK) {		foundzip = gamezip;		return 1;	} else if (unzLocateFile(basezip, filename, 1) == UNZ_OK) {		foundzip = basezip;		return 1;	}	return 0;}
开发者ID:Protovision,项目名称:io-lua,代码行数:11,


示例2: zip_extract_onefile

bool zip_extract_onefile(const char* zip_filename, const char* filename , const char* save_filename){    // 解压先使用 zipOpen64 来打开一个 ZIP 文件    unzFile uf = unzOpen64(zip_filename);//    // 需要先使用 unzGetGlobalInfo64 来取得该文件的一些信息,来了解这个压缩包里一共包含了多少个文件,等等。//    unz_global_info64 gi;////    if (unzGetGlobalInfo64(uf, &gi) != UNZ_OK) {//        return false;//    }    // 尝试zip文件中找到该文件szFileName。    int err = UNZ_OK;    if (unzLocateFile(uf, filename, CASESENSITIVITY) != UNZ_OK) {        printf("file %s not found in the zipfile/n", filename);        return false;    }    if (!zip_extract_currentfile(uf, save_filename)) {        return false;    }    unzClose(uf);    return true;}
开发者ID:hongwenjun,项目名称:srgb,代码行数:26,


示例3: unzOpen

bool ComicBookZIP::TestPassword(){	int retcode;	unzFile ZipFile;	ZipFile = unzOpen(filename.ToAscii());	bool retval;		if (!ZipFile) {		throw ArchiveException(filename, wxT("Could not open the file."));	}	if((retcode = unzLocateFile(ZipFile, Filenames->Item(0).ToAscii(), 0)) != UNZ_OK) {		unzClose(ZipFile);		throw ArchiveException(filename, ArchiveError(retcode));	}		if (password)		retcode = unzOpenCurrentFilePassword(ZipFile, password);	else		retcode = unzOpenCurrentFile(ZipFile);	if (retcode != UNZ_OK) {		unzClose(ZipFile);		throw ArchiveException(filename, ArchiveError(retcode));	}		char testByte;	if(unzReadCurrentFile(ZipFile, &testByte, 1) == Z_DATA_ERROR) // if the password is wrong		retval = false;	else		retval = true;	unzCloseCurrentFile(ZipFile);	unzClose(ZipFile);		return retval;}
开发者ID:parhelia512,项目名称:comical,代码行数:33,


示例4: unzLocateFile

idStr CZipFile::LoadTextFile(const idStr& fileName){	int result = unzLocateFile(_handle, fileName.c_str(), 0);	if (result != UNZ_OK) return "";	unz_file_info info;	unzGetCurrentFileInfo(_handle, &info, NULL, 0, NULL, 0, NULL, 0);	unsigned long fileSize = info.uncompressed_size;	int openResult = unzOpenCurrentFile(_handle);	idStr returnValue;	if (openResult == UNZ_OK)	{		char* buffer = new char[fileSize + 1];		// Read and null-terminate the string		unzReadCurrentFile(_handle, buffer, fileSize);		buffer[fileSize] = '/0';		returnValue = buffer;				delete[] buffer;	}	unzCloseCurrentFile(_handle);	return returnValue;}
开发者ID:dolanor,项目名称:TheDarkMod,代码行数:32,


示例5: InputSourceException

const byte *JARInputSource::openStream(){  if (stream != null)    throw InputSourceException(StringBuffer("openStream(): source stream already opened: '")+baseLocation+"'");  MemoryFile *mf = new MemoryFile;  mf->stream = sharedIS->getStream();  mf->length = sharedIS->length();  zlib_filefunc_def zlib_ff;  fill_mem_filefunc(&zlib_ff, mf);  unzFile fid = unzOpen2(null, &zlib_ff);  if (fid == 0) throw InputSourceException(StringBuffer("Can't locate file in JAR content: '")+inJarLocation+"'");  int ret = unzLocateFile(fid, inJarLocation->getChars(), 0);  if (ret != UNZ_OK) throw InputSourceException(StringBuffer("Can't locate file in JAR content: '")+inJarLocation+"'");  unz_file_info file_info;  ret = unzGetCurrentFileInfo(fid, &file_info, null, 0, null, 0, null, 0);  if (ret != UNZ_OK) throw InputSourceException(StringBuffer("Can't retrieve current file in JAR content: '")+inJarLocation+"'");  len = file_info.uncompressed_size;  stream = new byte[len];  ret = unzOpenCurrentFile(fid);  if (ret != UNZ_OK) throw InputSourceException(StringBuffer("Can't open current file in JAR content: '")+inJarLocation+"'");  ret = unzReadCurrentFile(fid, stream, len);  if (ret <= 0) throw InputSourceException(StringBuffer("Can't read current file in JAR content: '")+inJarLocation+"' ("+SString(ret)+")");  ret = unzCloseCurrentFile(fid);  if (ret == UNZ_CRCERROR) throw InputSourceException(StringBuffer("Bad JAR file CRC"));  ret = unzClose(fid);  return stream;};
开发者ID:OutOfOrder,项目名称:mod_highlight,代码行数:31,


示例6: unzOpen

bool ZipArchive::extract(std::string from, std::string where, std::vector<std::string> what){	unzFile archive = unzOpen(from.c_str());	auto onExit = vstd::makeScopeGuard([&]()	{		unzClose(archive);	});	for (std::string & file : what)	{		if (unzLocateFile(archive, file.c_str(), 1) != UNZ_OK)			return false;		std::string fullName = where + '/' + file;		std::string fullPath = fullName.substr(0, fullName.find_last_of("/"));		boost::filesystem::create_directories(fullPath);		// directory. No file to extract		// TODO: better way to detect directory? Probably check return value of unzOpenCurrentFile?		if (boost::algorithm::ends_with(file, "/"))			continue;		std::ofstream destFile(fullName, std::ofstream::binary);		if (!destFile.good())			return false;		if (!extractCurrent(archive, destFile))			return false;	}	return true;}
开发者ID:qdii,项目名称:vcmi,代码行数:32,


示例7: ArchGetFileW

extern "C" bool ArchGetFileW(HZIP hZip,WCHAR *pstrFile,byte **lpMem,int *dwSize){    bool r=false;    ZIPDECOMPRESSION *p=(ZIPDECOMPRESSION *)hZip;    if ((hZip) && (p->bHandleType == HT_DECOMPRESSOR) && (pstrFile) && (lpMem) && (dwSize))    {        LPCSTR pFileName=UnicodeToOemEx(pstrFile,-1);        unzGoToFirstFile(p->hZip);        p->bExctractToMem=true;        if (unzLocateFile(p->hZip,pFileName,CASESENSITIVITY) == UNZ_OK)            r=(ExtractCurrentFile(hZip,true) > -1) ? true : false;        else        {            ArchSetLastError(ARCH_FILE_NOT_FOUND);            r=false;        }        MemFree((void*)pFileName);        if (r)        {            *lpMem=(byte*)p->lpMem;            *dwSize=p->dwSize;        }    }    else        ArchSetLastError(ARCH_INVALID_PARAMETER);    return r;}
开发者ID:AlexWMF,项目名称:Carberp,代码行数:30,


示例8: sprintf

BITMAP *emudx_bitmap(emudx_file dat, int nb) {  char name[10];  int err;  BITMAP *bmp;  PALETTE pal;  sprintf(name,"%03d.png",nb);  err = unzLocateFile(dat,name,2);  if(err!=UNZ_OK){    print_debug("emudx: not found %s./n",name);    unzClose(dat);    return NULL;		// Fail: File not in zip  }  err = unzOpenCurrentFile(dat);  if(err!=UNZ_OK){    print_debug("emudx: unzOpenCurrentFile(): Error #%d/n",err);    unzCloseCurrentFile(dat);	// Is this needed when open failed?    unzClose(dat);    return NULL;			// Fail: Something internal  }  bmp = load_png_from_zip(dat,pal);  return bmp;}
开发者ID:albinoz,项目名称:raine,代码行数:25,


示例9: unzLocateFile

/** * Load a file from the ZOMG file. * @param filename Filename to load from the ZOMG file. * @param buf Buffer to store the file in. * @param len Length of the buffer. * @return Length of file loaded, or negative number on error. */int ZomgPrivate::loadFromZomg(const char *filename, void *buf, int len){	if (q->m_mode != ZomgBase::ZOMG_LOAD || !this->unz)		return -EBADF;	// Locate the file in the ZOMG file.	int ret = unzLocateFile(this->unz, filename, 2);	if (ret != UNZ_OK) {		// File not found.		return -ENOENT;	}	// Open the current file.	ret = unzOpenCurrentFile(this->unz);	if (ret != UNZ_OK) {		// Error opening the current file.		return -EIO;	}	// Read the file.	ret = unzReadCurrentFile(this->unz, buf, len);	unzCloseCurrentFile(this->unz);	// TODO: Check the return value!	// Return the number of bytes read.	return ret;}
开发者ID:GerbilSoft,项目名称:gens-gs-ii,代码行数:33,


示例10: result

dmz::Booleandmz::ReaderZip::open_file (const String &FileName) {   Boolean result (False);   if (_state.zf) {      close_file ();      result = _state.zip_error (unzLocateFile (         _state.zf,         FileName.get_buffer (),         1)); // Case sensitive      if (result) {         result = _state.zip_error (unzOpenCurrentFile (_state.zf));         if (result) { _state.fileName = FileName; }      }   }   else { _state.error.flush () << "Zip archive not open."; }   return result;}
开发者ID:ben-sangster,项目名称:dmz,代码行数:25,


示例11: zipFileExists

/********************************************************************************* Description***     Checks if a file exists in a zip file.****** Arguments***     zipName     - Name of zip file***     fileName    - Name of file insize zipfile to load****** Return***     1 = file exists, 0 = non existing zip or file in zip does not exists***     failure.***********************************************************************************/int zipFileExists(const char* zipName, const char* fileName){    char name[256];    unzFile zip;    if (fileName[0] == '*') {        strcpy(name, zipName);        name[strlen(zipName) - 3] = fileName[strlen(fileName) - 3];        name[strlen(zipName) - 2] = fileName[strlen(fileName) - 2];        name[strlen(zipName) - 1] = fileName[strlen(fileName) - 1];    }    else {        strcpy(name, fileName);    }    zip = unzOpen(zipName);    if (!zip) {        return 0;    }    if (unzLocateFile(zip, name, 2) == UNZ_END_OF_LIST_OF_FILE) {        unzClose(zip);        return 0;    }else{        unzClose(zip);        return 1;    }}
开发者ID:meesokim,项目名称:bluemsx-wii,代码行数:42,


示例12: unzLocateFile

unsigned char* CCZipFile::getFileData(const char *filename, unsigned long *filesize){    unsigned char *buffer = NULL;    *filesize = 0;        do     {        int ret = unzLocateFile(m_zipFile, filename, 1);        CC_BREAK_IF(UNZ_OK != ret);        std::string path;        unz_file_info info;        CC_BREAK_IF(UNZ_OK != getCurrentFileInfo(&path, &info));                ret = unzOpenCurrentFile(m_zipFile);        CC_BREAK_IF(UNZ_OK != ret);                buffer = new unsigned char[info.uncompressed_size];        int size = 0;        size = unzReadCurrentFile(m_zipFile, buffer, info.uncompressed_size);        CCAssert(size == 0 || size == (int)info.uncompressed_size, "the file size is wrong");                *filesize = info.uncompressed_size;        unzCloseCurrentFile(m_zipFile);    } while (0);        return buffer;}
开发者ID:fordream,项目名称:quick,代码行数:28,


示例13: Extract

	bool Extract(LPCTSTR szSrc, char** ppBuf, DWORD* pdwSize = NULL) throw()	{		if ( pdwSize )			*pdwSize = 0;		*ppBuf = NULL;		bool ret = false;		if ( unzLocateFile( hArchive, CT2CA( szSrc ), 2 ) == UNZ_OK )		{			unz_file_info fi = {};			if ( unzGetCurrentFileInfo( hArchive, &fi, NULL, NULL, NULL, NULL, NULL, NULL ) == UNZ_OK )			{				if ( unzOpenCurrentFile( hArchive ) == UNZ_OK ) 				{					if ( pdwSize )						*pdwSize = fi.uncompressed_size;					*ppBuf = new char[ fi.uncompressed_size + 2 ];					if ( *ppBuf )					{						ZeroMemory( *ppBuf, fi.uncompressed_size + 2 );						ret = ( unzReadCurrentFile( hArchive, *ppBuf, fi.uncompressed_size ) == (int)fi.uncompressed_size );					}					unzCloseCurrentFile( hArchive );				}			}		}		return ret;	}
开发者ID:ivan386,项目名称:Shareaza,代码行数:28,


示例14: unzOpen

bool ApkFile::open(const std::string &path){    unzFile uf = unzOpen(path.c_str());    if (!uf) {        LOGE("%s: Failed to open archive", path.c_str());        return false;    }    auto close_uf = util::finally([&]{        unzClose(uf);    });    if (unzLocateFile(uf, "AndroidManifest.xml", nullptr) != UNZ_OK) {        LOGE("%s: package does not contain AndroidManifest.xml", path.c_str());        return false;    }    std::vector<unsigned char> data;    if (!read_to_memory(uf, &data)) {        LOGE("%s: Failed to extract AndroidManifest.xml", path.c_str());        return false;    }    // Load AndroidManifest.xml and check package name    return parse_manifest(data.data(), data.size());}
开发者ID:Ricky310711,项目名称:DualBootPatcher,代码行数:26,


示例15: unzOpen2_64

bool ZipArchive::extract(boost::filesystem::path from, boost::filesystem::path where, std::vector<std::string> what){	unzFile archive = unzOpen2_64(from.c_str(), FileStream::GetMinizipFilefunc());	auto onExit = vstd::makeScopeGuard([&]()	{		unzClose(archive);	});	for (const std::string & file : what)	{		if (unzLocateFile(archive, file.c_str(), 1) != UNZ_OK)			return false;		const boost::filesystem::path fullName = where / file;		const boost::filesystem::path fullPath = fullName.parent_path();		boost::filesystem::create_directories(fullPath);		// directory. No file to extract		// TODO: better way to detect directory? Probably check return value of unzOpenCurrentFile?		if (boost::algorithm::ends_with(file, "/"))			continue;		FileStream destFile(fullName, std::ios::out | std::ios::binary);		if (!destFile.good())			return false;		if (!extractCurrent(archive, destFile))			return false;	}	return true;}
开发者ID:argarak,项目名称:vcmi,代码行数:32,


示例16: m_ZipPath

	zlib_FileResource::zlib_FileResource(const std::string & zipPath, const std::string & fileName)		:	m_ZipPath(zipPath),			m_FileName(fileName)	{		unzFile zipFile = unzOpen(zipPath.c_str());		KeziaAssert(unzLocateFile(zipFile, fileName.c_str(), 0) == UNZ_OK);		unz_file_info fileInfo;		unzGetCurrentFileInfo(zipFile, &fileInfo, nullptr, 0, nullptr, 0, nullptr, 0);		m_Data = new char[fileInfo.uncompressed_size + 1];		if(unzOpenCurrentFilePassword(zipFile, k_Password.c_str()) != UNZ_OK)		{			LOG("wrong password");		}				m_DataSize = unzReadCurrentFile(zipFile, const_cast<char *>(m_Data), fileInfo.uncompressed_size);		const_cast<char &>(m_Data[m_DataSize]) = '/0';				unzCloseCurrentFile(zipFile);				unzClose(zipFile);	}
开发者ID:kWickert,项目名称:Kezia,代码行数:25,


示例17: readfromzip_cb

static int readfromzip_cb(lua_State* L){	const char* zipname = luaL_checkstring(L, 1);	const char* subname = luaL_checkstring(L, 2);	int result = 0;	unzFile zf = unzOpen(zipname);	if (zf)	{		int i = unzLocateFile(zf, subname, 0);		if (i == UNZ_OK)		{			unz_file_info fi;			unzGetCurrentFileInfo(zf, &fi,				NULL, 0, NULL, 0, NULL, 0);			char* buffer = malloc(fi.uncompressed_size);			if (buffer)			{				unzOpenCurrentFile(zf);				i = unzReadCurrentFile(zf, buffer, fi.uncompressed_size);				if (i == fi.uncompressed_size)				{					lua_pushlstring(L, buffer, fi.uncompressed_size);					result = 1;				}				free(buffer);			}		}		unzClose(zf);	}	return result;}
开发者ID:NRauh,项目名称:wordgrinder,代码行数:35,


示例18: fill_functions

bool ArchiveReader::ExtractSingleFile( const std::string& FName, const std::string& Password, int* AbortFlag, float* Progress, const clPtr<iOStream>& FOut ){	int err = UNZ_OK;	std::string ZipName = FName;	std::replace( ZipName.begin(), ZipName.end(), '//', '/' );	clPtr<iIStream> TheSource = FSourceFile;	FSourceFile->Seek( 0 );	/// Decompress the data	zlib_filefunc64_def ffunc;	fill_functions( TheSource.GetInternalPtr(), &ffunc );	unzFile uf = unzOpen2_64( "", &ffunc );	if ( unzLocateFile( uf, ZipName.c_str(), 0/*CASESENSITIVITY - insensitive*/ ) != UNZ_OK )	{		// WARNING: "File %s not found in the zipfile/n", FName.c_str()		return false;	}	err = ExtractCurrentFile_ZIP( uf, Password.empty() ? NULL : Password.c_str(), AbortFlag, Progress, FOut );	unzClose( uf );	return ( err == UNZ_OK );}
开发者ID:BlastarIndia,项目名称:Android-NDK-Game-Development-Cookbook,代码行数:28,


示例19: MemoryReadStream

SeekableReadStream *ZipArchive::createReadStreamForMember(const String &name) const {	if (unzLocateFile(_zipFile, name.c_str(), 2) != UNZ_OK)		return 0;	unz_file_info fileInfo;	if (unzOpenCurrentFile(_zipFile) != UNZ_OK)		return 0;	if (unzGetCurrentFileInfo(_zipFile, &fileInfo, NULL, 0, NULL, 0, NULL, 0) != UNZ_OK)		return 0;	byte *buffer = (byte *)malloc(fileInfo.uncompressed_size);	assert(buffer);	if (unzReadCurrentFile(_zipFile, buffer, fileInfo.uncompressed_size) != (int)fileInfo.uncompressed_size) {		free(buffer);		return 0;	}	if (unzCloseCurrentFile(_zipFile) != UNZ_OK) {		free(buffer);		return 0;	}	return new MemoryReadStream(buffer, fileInfo.uncompressed_size, DisposeAfterUse::YES);	// FIXME: instead of reading all into a memory stream, we could	// instead create a new ZipStream class. But then we have to be	// careful to handle the case where the client code opens multiple	// files in the archive and tries to use them independently.}
开发者ID:AdamRi,项目名称:scummvm-pink,代码行数:31,


示例20: Extract

bool CMinizip::Extract(LPCTSTR FileName, LPCTSTR DestPath, UINT BufSize){    USES_CONVERSION;    if (unzLocateFile(m_ZipFile, T2CA(FileName), 0) != UNZ_OK)        return(FALSE);    if (unzOpenCurrentFile(m_ZipFile) != UNZ_OK)        return(FALSE);    CByteArray	ba;    ba.SetSize(BufSize);    bool	retc = FALSE;	// assume failure    TRY {        CFile	DestFile(DestPath, CFile::modeCreate | CFile::modeWrite);        int	BytesRead;        while ((BytesRead = unzReadCurrentFile(m_ZipFile, ba.GetData(), BufSize)) > 0) {            DestFile.Write(ba.GetData(), BytesRead);        }        if (!BytesRead)	// if EOF            retc = TRUE;	// success provided current file closes OK    }    CATCH (CFileException, e) {        e->ReportError();    }    END_CATCH    if (unzCloseCurrentFile(m_ZipFile) != UNZ_OK)	// close fails if bad CRC        return(FALSE);    return(retc);}
开发者ID:victimofleisure,项目名称:FFRend,代码行数:27,


示例21: FileClose

bool ZipFile::LoadFile(const char* package, const char* file){	FileClose();	unzFile fp = unzOpen(package);	if (!fp) return false;	if (unzLocateFile(fp,file,0) != UNZ_OK)	{		unzClose(fp);		return false;	}	if (unzOpenCurrentFile(fp) != UNZ_OK)	{		unzClose(fp);		return false;	}	unz_file_info nfo;	unzGetCurrentFileInfo(fp,&nfo,0,0,0,0,0,0);	size = (long)nfo.uncompressed_size;	data = new char[size];	unzReadCurrentFile(fp,data,size);	unzCloseCurrentFile(fp);	unzClose(fp);	return true;}
开发者ID:isdom,项目名称:common-android-native-libs,代码行数:32,


示例22: open

bool UnzipFile::open(){	if (d->filepath.isEmpty())	{		PAINTFIELD_WARNING << "file path not specified";		return false;	}		if (d->archive->d->currentUnzipFile)	{		PAINTFIELD_WARNING << "another unzip file is open";		return false;	}		auto unzip = d->archive->d->unzip;		if (unzLocateFile(unzip, d->filepath.toUtf8(), 1) != UNZ_OK)	{		PAINTFIELD_WARNING << "file not found";		return false;	}		unz_file_info64 fileInfo;	unzGetCurrentFileInfo64(unzip, &fileInfo, 0, 0, 0, 0, 0, 0);	d->size = fileInfo.uncompressed_size;		if (unzOpenCurrentFile(unzip) != UNZ_OK)	{		PAINTFIELD_WARNING << "failed to open current file";		return false;	}		setOpenMode(ReadOnly);	return true;}
开发者ID:h2so5,项目名称:PaintField,代码行数:35,


示例23: do_extract_from_opened_pack_archive_onefile

int do_extract_from_opened_pack_archive_onefile(    unzFile uf,    const char* filename,    int opt_extract_without_path,    const char* prefix_extracting_name,    int transform_path_separator, int quiet){    int iCaseSensitivity = 1;    if (unzLocateFile(uf,filename,iCaseSensitivity)!=UNZ_OK)    {        u_printf("file %s not found in the zipfile/n",filename);        return 2;    }    if (is_last_char_path_separator(prefix_extracting_name))    {        if (quiet == 0)            u_printf("Creating extracting directory: %s/n",prefix_extracting_name);        mkDirPortable(prefix_extracting_name);    }    if (do_extract_from_opened_pack_archive_currentfile(uf,&opt_extract_without_path,prefix_extracting_name,transform_path_separator,quiet) == UNZ_OK)        return 0;    else        return 1;}
开发者ID:UnitexGramLab,项目名称:unitex-core,代码行数:27,


示例24: data_file_open

/* * Open a data file. */data_file_t *data_file_open(char *name){	char *n;	FILE *fh;	zipped_t *z;	if (path.zip) {	    z = malloc(sizeof(zipped_t));	    z->name = strdup(name);	    z->zip = unzDup(path.zip);	    if (unzLocateFile(z->zip, name, 0) != UNZ_OK ||	    	unzOpenCurrentFile(z->zip) != UNZ_OK) {			unzClose(z->zip);			z = NULL;		}	    return (data_file_t *)z;	} else {		n = malloc(strlen(path.name) + strlen(name) + 2);		sprintf(n, "%s/%s", path.name, name);		str_slash(n);		fh = fopen(n, "rb");		return (data_file_t *)fh;	}}
开发者ID:uli,项目名称:xrick-spmp8000,代码行数:28,


示例25: unzOpen64

bool eFileTypeZIP::Open(const char* name) const{	char contain_path[xIo::MAX_PATH_LEN];	char contain_name[xIo::MAX_PATH_LEN];	if(Contain(name, contain_path, contain_name))	{		unzFile h = unzOpen64(contain_path);		if(!h)			return false;		bool ok = false;		if(unzLocateFile(h, contain_name, 0) == UNZ_OK)		{			ok = OpenCurrent(h);		}		unzClose(h);		return ok;	}	char opened_name[xIo::MAX_PATH_LEN];	bool ok = Open(unzOpen64(name), opened_name);	if(ok)	{		char full_name[xIo::MAX_PATH_LEN];		strcpy(full_name, name);		strcat(full_name, "/");		strcat(full_name, opened_name);		OpLastFile(full_name);	}	return ok;}
开发者ID:djdron,项目名称:UnrealSpeccyP,代码行数:29,


示例26: getFileListFromZip

	void getFileListFromZip(VectorFileInfo& _result, const char*_zipfile,  const std::string& _folder, const std::string& filename)	{		unzFile pFile = NULL;		std::string path = _folder + filename;		bool isDir = false;				pFile = unzOpen(_zipfile);		if (!pFile)			return;		do		{			int nRet = unzLocateFile(pFile, path.c_str(), 1);			CC_BREAK_IF(UNZ_OK != nRet);						char szFilePathA[260];			unz_file_info unzInfo;			nRet = unzGetCurrentFileInfo(pFile, &unzInfo, szFilePathA, sizeof(szFilePathA), NULL, 0, NULL, 0);			CC_BREAK_IF(UNZ_OK != nRet);						if (szFilePathA[unzInfo.size_filename - 1] == '/' ||			    szFilePathA[unzInfo.size_filename - 1] == '//')				isDir = true;			else				isDir = false;							_result.push_back(FileInfo(filename, isDir));		} while (0);				unzClose(pFile);	}
开发者ID:dayongxie,项目名称:MyGUI,代码行数:31,


示例27: OpenFile

int OpenFile(ngePackage* pkg, const char* fname,int flag) {	ngePackageZip* zip = (ngePackageZip*)pkg;	ngeVFZip* f;	unzFile file;	if (flag != IO_RDONLY)		return 0;	file = unzOpen(zip->fname);	if (file == NULL)		return 0;	if(unzLocateFile(file, fname, 0) != UNZ_OK)		goto fail;	if (zip->passwd == NULL) {		if (unzOpenCurrentFile(file) != UNZ_OK)			goto fail;	}	else {		if (unzOpenCurrentFilePassword(file, zip->passwd) != UNZ_OK)			goto fail;	}	f = (ngeVFZip*)malloc(sizeof(ngeVFZip));	f->file = file;	f->op = &zipFileOperation;	return ngeVFAdd((ngeVF*)f);fail:	unzClose(file);	return 0;}
开发者ID:eledot,项目名称:libnge2,代码行数:34,


示例28: logSetPosition

void logSetPosition(unsigned long pos) {  blocks q;  unsigned long count = 0;  BYTE temp;  if (pos >= logMinBlockPosition && pos < logMaxBlockPosition) {    logPosition = pos;  } else if (pos < logMinBlockPosition) {    // Delete all blocks and re-read the file back to our current position    while (block != NULL) {      q = block;      block = block->next;      mbDestroy(&(q->item));    }    logMinBlockPosition = pos;    logMaxBlockPosition = pos;    logPosition = pos;    unzCloseCurrentFile(logFile);    unzClose(logFile);    logFile = unzOpen(logFileName);    unzLocateFile(logFile, "log.dat", 0);    unzOpenCurrentFile(logFile);    while (count < pos) {      unzReadCurrentFile(logFile, &temp, 1);      count++;    }    zipFilePosition = pos;  } else {    temp = 1;  }}
开发者ID:1taplay,项目名称:winbolo,代码行数:31,


示例29: sysfile_open

/* * Open a data file. */file_tsysfile_open(const char *name){#ifdef ENABLE_ZIP    if (rootPath.zip)    {        unzFile zh = rootPath.zip;        if (unzLocateFile(zh, name, 0) != UNZ_OK ||            unzOpenCurrentFile(zh) != UNZ_OK)        {                return NULL;        }        return (file_t)zh;    }    else /* uncompressed file */#endif /* ENABLE_ZIP */    {        FILE *fh;        char *fullPath = sysmem_push(strlen(rootPath.name) + strlen(name) + 2);        if (!fullPath)        {            return NULL;        }        sprintf(fullPath, "%s/%s", rootPath.name, name);        str_toNativeSeparators(fullPath);        fh = fopen(fullPath, "rb");        sysmem_pop(fullPath);        return (file_t)fh;    }}
开发者ID:foolsh,项目名称:xrick,代码行数:33,


示例30: arcDecompressFile

bool arcDecompressFile (const CString &sArchive, const CString &sFilename, IWriteStream &Output, CString *retsError)//	arcDecompressFile////	Unzips to a stream.	{	unzFile theZipFile = unzOpen(sArchive.GetASCIIZPointer());	if (theZipFile == NULL)		{		*retsError = strPatternSubst(CONSTLIT("Unable to open file: %s."), sArchive);		return false;		}	if (unzLocateFile(theZipFile, sFilename.GetASCIIZPointer(), 0) != UNZ_OK)		{		unzClose(theZipFile);		*retsError = strPatternSubst(CONSTLIT("Unable to find file in archive: %s."), sFilename);		return false;		}	if (unzOpenCurrentFile(theZipFile) != UNZ_OK)		{		unzClose(theZipFile);		*retsError = strPatternSubst(CONSTLIT("Unable to open file in archive: %s."), sFilename);		return false;		}	while (true)		{		char szBuffer[BUFFER_SIZE];		int iRead = unzReadCurrentFile(theZipFile, szBuffer, BUFFER_SIZE);		if (iRead == 0)			break;		else if (iRead < 0)			{			unzCloseCurrentFile(theZipFile);			unzClose(theZipFile);			*retsError = CONSTLIT("Error reading archive.");			return false;			}		Output.Write(szBuffer, iRead);		}	//	Returns UNZ_CRCERROR if the file failed its CRC check.	if (unzCloseCurrentFile(theZipFile) != UNZ_OK)		{		unzClose(theZipFile);		*retsError = strPatternSubst(CONSTLIT("File in archive corrupted: %s."), sArchive);		return false;		}	unzClose(theZipFile);	return true;	}
开发者ID:gmoromisato,项目名称:Dev,代码行数:59,



注:本文中的unzLocateFile函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ unzOpen函数代码示例
C++ unzGoToNextFile函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。