这篇教程C++ FS_Close函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中FS_Close函数的典型用法代码示例。如果您正苦于以下问题:C++ FS_Close函数的具体用法?C++ FS_Close怎么用?C++ FS_Close使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了FS_Close函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: cached_io_get_state_and_closekal_int32 cached_io_get_state_and_close(cached_io_t* io, cached_io_file_state_t* state){ kal_int32 ret; FS_HANDLE fh = io->file_h; if (fh < 0) { return -1; } ret = cached_io_detach(io); if (ret < 0) /* there may not be enough space to flush buffers */ { FS_Close(fh); /* close the file handle anyway */ return ret; /* return error code */ } if (state) { cached_io_get_state(fh, state); } ret = FS_Close(fh); ASSERT(ret >= 0); return ret;}
开发者ID:12019,项目名称:mtktest,代码行数:25,
示例2: HPAK_ResourceForIndexqboolean HPAK_ResourceForIndex( const char *filename, int index, resource_t *pRes ){ file_t *f; hpak_header_t hdr; hpak_container_t hpakcontainer; string pakname; if( !filename || !filename[0] ) return false; Q_strncpy( pakname, filename, sizeof( pakname )); FS_StripExtension( pakname ); FS_DefaultExtension( pakname, ".hpk" ); f = FS_Open( pakname, "rb", false ); FS_Read( f, &hdr, sizeof( hdr )); if( hdr.ident != IDCUSTOMHEADER ) { MsgDev( D_ERROR, "HPAK_ResourceForIndex: %s it's not a HPK file./n", pakname ); FS_Close( f ); return false; } if( hdr.version != IDCUSTOM_VERSION ) { MsgDev( D_ERROR, "HPAK_ResourceForIndex: %s has invalid version (%i should be %i)./n", pakname, hdr.version, IDCUSTOM_VERSION ); FS_Close( f ); return false; } FS_Seek( f, hdr.seek, SEEK_SET ); FS_Read( f, &hpakcontainer.count, sizeof( hpakcontainer.count )); if( hpakcontainer.count < 1 || hpakcontainer.count > MAX_FILES_IN_WAD ) { MsgDev( D_ERROR, "HPAK_ResourceForIndex: %s has too many lumps %u./n", pakname, hpakcontainer.count ); FS_Close( f ); return false; } if( index < 1 || index > hpakcontainer.count ) { MsgDev( D_ERROR, "HPAK_ResourceForIndex: %s, lump with index %i doesn't exist./n", pakname, index ); FS_Close( f ); return false; } hpakcontainer.dirs = Z_Malloc( sizeof( hpak_dir_t ) * hpakcontainer.count ); // we could just seek the right data... FS_Read( f, hpakcontainer.dirs, sizeof( hpak_dir_t ) * hpakcontainer.count ); *pRes = hpakcontainer.dirs[index-1].DirectoryResource; Mem_Free( hpakcontainer.dirs ); FS_Close( f ); return true;}
开发者ID:DavidKnight247,项目名称:xash3d,代码行数:58,
示例3: HPAK_ResourceForIndex/* <2aac9> ../engine/hashpak.c:772 */qboolean HPAK_ResourceForIndex(char *pakname, int nIndex, struct resource_s *pResource){ hash_pack_header_t header; hash_pack_directory_t directory; hash_pack_entry_t *entry; char name[MAX_PATH]; FileHandle_t fp; if (cmd_source != src_command) return FALSE; Q_snprintf(name, ARRAYSIZE(name), "%s", pakname);#ifdef REHLDS_FIXES name[ARRAYSIZE(name) - 1] = 0;#endif // REHLDS_FIXES COM_DefaultExtension(name, HASHPAK_EXTENSION); fp = FS_Open(name, "rb"); if (!fp) { Con_Printf("ERROR: couldn't open %s./n", name); return FALSE; } FS_Read(&header, sizeof(hash_pack_header_t), 1, fp); if (Q_strncmp(header.szFileStamp, "HPAK", sizeof(header.szFileStamp))) { Con_Printf("%s is not an HPAK file/n", name); FS_Close(fp); return FALSE; } if (header.version != HASHPAK_VERSION) { Con_Printf("HPAK_List: version mismatch/n"); FS_Close(fp); return FALSE; } FS_Seek(fp, header.nDirectoryOffset, FILESYSTEM_SEEK_HEAD); FS_Read(&directory.nEntries, 4, 1, fp); if (directory.nEntries < 1 || (unsigned int)directory.nEntries > MAX_FILE_ENTRIES) { Con_Printf("ERROR: HPAK had bogus # of directory entries: %i/n", directory.nEntries); FS_Close(fp); return FALSE; } if (nIndex < 1 || nIndex > directory.nEntries) { Con_Printf("ERROR: HPAK bogus directory entry request: %i/n", nIndex); FS_Close(fp); return FALSE; } directory.p_rgEntries = (hash_pack_entry_t *)Mem_Malloc(sizeof(hash_pack_entry_t) * directory.nEntries); FS_Read(directory.p_rgEntries, sizeof(hash_pack_entry_t) * directory.nEntries, 1, fp); entry = &directory.p_rgEntries[nIndex - 1]; Q_memcpy(pResource, &entry->resource, sizeof(resource_t)); FS_Close(fp); Mem_Free(directory.p_rgEntries); return TRUE;}
开发者ID:Adidasman1,项目名称:rehlds,代码行数:59,
示例4: Host_WriteConfig/*===============Host_WriteConfigWrites key bindings and archived cvars to config.cfg===============*/void Host_WriteConfig( void ){ kbutton_t *mlook, *jlook; file_t *f; // if client not loaded, client cvars will lost if( !clgame.hInstance ) { MsgDev( D_NOTE, "Client not loaded, skipping config save!/n" ); return; } MsgDev( D_NOTE, "Host_WriteConfig()/n" ); f = FS_Open( "config.cfg", "w", true ); if( f ) { FS_Printf( f, "//=======================================================================/n"); FS_Printf( f, "///t/t/tCopyright XashXT Group %s C++ FS_CreatePath函数代码示例 C++ FS_CALL函数代码示例
|