• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ FS_Close函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: cached_io_get_state_and_close

kal_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,代码来源:mtv_cached_io.c


示例2: HPAK_ResourceForIndex

qboolean 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,代码来源:hpak.c


示例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,代码来源:hashpak.cpp


示例4: Host_WriteConfig

/*
===============
Host_WriteConfig

Writes 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 ©\n", Q_timestamp( TIME_YEAR_ONLY ));
		FS_Printf( f, "//\t\t\tconfig.cfg - archive of cvars\n" );
		FS_Printf( f, "//=======================================================================\n" );
		Cmd_WriteVariables( f );

		FS_Printf( f, "exec keyboard.cfg\n" );

		FS_Printf( f, "exec userconfig.cfg\n" );

		FS_Close( f );
	}
	else MsgDev( D_ERROR, "Couldn't write config.cfg.\n" );

	if( cls.initialized && ( cls.keybind_changed || !FS_FileExists( "keyboard.cfg", true ) ) )
	{
		f = FS_Open( "keyboard.cfg", "w", true );
		if( f )
		{
			FS_Printf( f, "//=======================================================================\n");
			FS_Printf( f, "//\t\t\tCopyright XashXT Group %s ©\n", Q_timestamp( TIME_YEAR_ONLY ));
			FS_Printf( f, "//\t\t\tkeyboard.cfg - archive of keybindings\n" );
			FS_Printf( f, "//=======================================================================\n" );
			Key_WriteBindings( f );

			mlook = (kbutton_t *)clgame.dllFuncs.KB_Find( "in_mlook" );
			jlook = (kbutton_t *)clgame.dllFuncs.KB_Find( "in_jlook" );

			if( mlook && ( mlook->state & 1 ))
				FS_Printf( f, "+mlook\n" );

			if( jlook && ( jlook->state & 1 ))
				FS_Printf( f, "+jlook\n" );

			FS_Close( f );
		}
		else MsgDev( D_ERROR, "Couldn't write keyboard.cfg.\n" );
	}
	else
		MsgDev( D_NOTE, "Keyboard configuration not changed\n" );
}
开发者ID:GAMELASTER,项目名称:xash3d,代码行数:64,代码来源:con_utils.c


示例5: HPAK_FlushHostQueue

/* <2ae8e> ../engine/hashpak.c:1599 */
NOXREF char *HPAK_GetItem(int item)
{
	NOXREFCHECK;

	int nCurrent;
	hash_pack_header_t header;
	hash_pack_directory_t directory;
	hash_pack_entry_t *entry;
	static char name[MAX_PATH];
	char szFileName[MAX_PATH];
	FileHandle_t fp;

	HPAK_FlushHostQueue();

	Q_snprintf(name, ARRAYSIZE(name), "%s", "custom");

	COM_DefaultExtension(name, HASHPAK_EXTENSION);
	fp = FS_Open(name, "rb");

	if (!fp)
		return "";

	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 "";
	}
	if (header.version != HASHPAK_VERSION)
	{
		Con_Printf("HPAK_List:  version mismatch\n");
		FS_Close(fp);
		return "";
	}
	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 "";
	}
	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);
	nCurrent = directory.nEntries - 1;
	if (nCurrent > item)
		nCurrent = item;
	entry = &directory.p_rgEntries[nCurrent];
	COM_FileBase(entry->resource.szFileName, szFileName);
	Q_snprintf(name, sizeof(name), "!MD5%s", MD5_Print(entry->resource.rgucMD5_hash));
	FS_Close(fp);
	Mem_Free(directory.p_rgEntries);
	return name;
}
开发者ID:Adidasman1,项目名称:rehlds,代码行数:56,代码来源:hashpak.cpp


示例6: xml_generate_inline_element

/*****************************************************************************
 * FUNCTION
 *  xml_generate_inline_element
 * DESCRIPTION
 *  This function is for application to generate a whole element without child element
 *  and attribute, only content. just as following: <a> test </a>.
 * PARAMETERS
 *  hd          [IN]    handle of generator
 *  el          [IN]    element name
 *  data        [IN]    Filename or buffer with data. 
 *  datalen     [IN]    if with buffer, datalen is the length of buffer, 
 *                      if with file, datalen should be 0
 * RETURNS
 *      <0: means failed, returns error code;
 *      0 :  means succeed;
 *****************************************************************************/
kal_int32 xml_generate_inline_element(XG_HANDLE hd, const kal_char* el, kal_char* data, kal_uint32 datalen)
{
    kal_int32 ret;
    kal_uint32 len_read, len;
    FS_HANDLE fhandle = -1;
    kal_char tempbuf[TEMP_BUF_LEN];
    if ((ret = xml_generate_stag(hd, el, NULL, 0)) < 0)
    {
        return ret;
    }

	if (datalen == 0)
	{   
	    fhandle = FS_Open((WCHAR*)data, FS_READ_ONLY);
        if (fhandle < 0)
        {
            return XG_E_FAIL;
        }
        ret = FS_GetFileSize(fhandle, &len);
        if (ret < 0)
        {
            FS_Close(fhandle);
            return XG_E_FAIL;
        }       
		while ((ret = FS_Read(fhandle, tempbuf, TEMP_BUF_LEN-1, &len_read)) >= FS_NO_ERROR)
        {
        	if (len_read == 0)
            {
            	break;
            }
			if ((ret=xml_generate_converted_data(hd, tempbuf, len_read)) < 0)
			{
				 return ret;
			}
		}
		FS_Close(fhandle);
	}
	else
    {
    	if ((ret = xml_generate_converted_data(hd, data, datalen)) < 0)
    {
        return ret;
    }
	}

/*
    if ((ret = xml_generate_data(hd, data, datalen)) < 0)
    {
        return ret;
    }
    */
    return xml_generate_etag(hd, el);
    
}
开发者ID:WayWingsDev,项目名称:testmywatch,代码行数:70,代码来源:xmlgen_main.c


示例7: vid_create_dummy_video_file

/*****************************************************************************
 * FUNCTION
 *  vid_create_dummy_video_file
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void vid_create_dummy_video_file(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    FS_HANDLE fd = -1;
    kal_uint32 len;
    kal_int32 result;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifdef __NVRAM_IN_USB_MS__
    if (stack_query_boot_mode() == USBMS_BOOT)
    {
        return;
    }
#endif /* __NVRAM_IN_USB_MS__ */ 

    /* creat folder */
    fd = FS_Open((kal_uint16*)VID_SYSTEM_FOLDER, FS_OPEN_DIR | FS_READ_ONLY);

    if (fd  >= 0)
    {
        /* path already exist */        
        FS_Close(fd);
    }
    else
    {
        /* file not exist */
        fd = FS_CreateDir((kal_uint16*)VID_SYSTEM_FOLDER);
    }

    if ((fd = FS_Open((kal_wchar*) VID_DUMMY_INIT_FILE, FS_READ_ONLY)) >= 0)
    {
        FS_Close(fd);
        return;
    }
    else if ((fd = FS_Open((kal_wchar*) VID_INIT_FILE, FS_READ_ONLY)) >= 0)
    {
        FS_Close(fd);
        /* FS_Rename((kal_wchar*)VID_INIT_FILE, (kal_wchar*)VID_DUMMY_INIT_FILE); */
        return;
    }
    fd = FS_Open((kal_wchar*) VID_DUMMY_INIT_FILE, FS_CREATE | FS_READ_WRITE);
    if (fd >= 0)
    {
        result = FS_Write(fd, DUMMY_VIDEO_FILE_CONTENT, kal_wstrlen(DUMMY_VIDEO_FILE_CONTENT) * ENCODE_BYTE, &len);
        FS_Close(fd);
    }

}
开发者ID:12019,项目名称:mtktest,代码行数:62,代码来源:vid_main.c


示例8: GPSLocateNvramStoreData

static kal_bool GPSLocateNvramStoreData(void)
{
	FS_HANDLE file_handle;
	int result;
	unsigned int len;

	if (app_ucs2_strlen((const kal_int8*)gGPSLocateNvramFullPathFileName) == 0)
	{
		//empty file name
		return KAL_FALSE;
	}
	//open file
	file_handle = FS_Open(gGPSLocateNvramFullPathFileName, FS_READ_WRITE);
	if (file_handle < FS_NO_ERROR)
	{
		//fail to open
		return KAL_FALSE;
	}
	//write
	result = FS_Write(file_handle, &(gGPSLocateNvramDataCache.Cache), sizeof(GPSLocateNvramDataStruct_t), &len);
	FS_Close(file_handle);
	if (result != FS_NO_ERROR || len != sizeof(GPSLocateNvramDataStruct_t))
	{
		return KAL_FALSE;
	}
	else
	{
		return KAL_TRUE;
	}
}
开发者ID:robbie-cao,项目名称:tracker,代码行数:30,代码来源:gps_app_nvram_mgr.c


示例9: GPSLocateNvramLoadData

static kal_bool GPSLocateNvramLoadData(void)
{
	FS_HANDLE file_handle;
	int result;
	unsigned int len;
	GPSLocateNvramDataStruct_t tmpCache;

	if (app_ucs2_strlen((const kal_int8*)gGPSLocateNvramFullPathFileName) == 0)
	{
		//empty file name
		return KAL_FALSE;
	}
	//open file
	file_handle = FS_Open(gGPSLocateNvramFullPathFileName, FS_READ_ONLY);
	if (file_handle < FS_NO_ERROR)
	{
		//fail to open
		return KAL_FALSE;
	}
	//read
	result = FS_Read(file_handle, &tmpCache, sizeof(GPSLocateNvramDataStruct_t), &len);
	FS_Close(file_handle);
	if (result != FS_NO_ERROR || len != sizeof(GPSLocateNvramDataStruct_t))
	{
		//read fail
		return KAL_FALSE;
	}
	//copy data to global cache
	memcpy(&(gGPSLocateNvramDataCache.Cache), &tmpCache, sizeof(GPSLocateNvramDataStruct_t));
	gGPSLocateNvramDataCache.Valid = KAL_TRUE;
	return KAL_TRUE;
}
开发者ID:robbie-cao,项目名称:tracker,代码行数:32,代码来源:gps_app_nvram_mgr.c


示例10: CL_StopPlayback

/*
==============
CL_StopPlayback

Called when a demo file runs out, or the user starts a game
==============
*/
void CL_StopPlayback( void )
{
	if( !cls.demoplayback ) return;

	// release demofile
	FS_Close( cls.demofile );
	cls.demoplayback = false;
	demo.framecount = 0;
	cls.demofile = NULL;

	cls.olddemonum = max( -1, cls.demonum - 1 );
	Mem_Free( demo.directory.entries );
	demo.directory.numentries = 0;
	demo.directory.entries = NULL;
	demo.entry = NULL;

	cls.demoname[0] = '\0';	// clear demoname too
	menu.globals->demoname[0] = '\0';

	S_StopAllSounds();
	S_StopBackgroundTrack();

	if( !cls.changedemo )
	{
		// let game known about demo state	
		Cvar_FullSet( "cl_background", "0", CVAR_READ_ONLY );
		cls.state = ca_disconnected;
		cl.background = 0;
		cls.demonum = -1;
	}
}
开发者ID:nekonomicon,项目名称:xash3d,代码行数:38,代码来源:cl_demo.c


示例11: applib_get_file_size

/*****************************************************************************
 * FUNCTION
 *  applib_get_file_size
 * DESCRIPTION
 *  This function is used to get the size of one file.
 * PARAMETERS
 *  filename        [IN]        The filename
 * RETURNS
 *  file size.
 *****************************************************************************/
kal_uint32 applib_get_file_size(kal_wchar *filename)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    kal_int32 fileHandle;
    kal_uint32 fileSize = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (filename == NULL)
    {
        return 0;
    }

    fileHandle = FS_Open(filename, APPLIB_ASYNC_FILE_READ | FS_NONBLOCK_MODE | FS_OPEN_SHARED);
    if (fileHandle < 0)
    {
        return 0;
    }
    FS_GetFileSize(fileHandle, &fileSize);
    FS_Close(fileHandle);
    return fileSize;
}
开发者ID:WayWingsDev,项目名称:testmywatch,代码行数:35,代码来源:app_asyncfile.c


示例12: Host_WriteConfig

/*
===============
Host_WriteConfig

Writes key bindings and archived cvars to config.cfg
===============
*/
void Host_WriteConfig( void )
{
	kbutton_t	*mlook, *jlook;
	file_t	*f;

	if( !clgame.hInstance ) return;

	MsgDev( D_NOTE, "Host_WriteConfig()\n" );
	f = FS_Open( "config.cfg", "w", false );
	if( f )
	{
		FS_Printf( f, "//=======================================================================\n");
		FS_Printf( f, "//\t\t\tCopyright XashXT Group %s ©\n", Q_timestamp( TIME_YEAR_ONLY ));
		FS_Printf( f, "//\t\t\tconfig.cfg - archive of cvars\n" );
		FS_Printf( f, "//=======================================================================\n" );
		Key_WriteBindings( f );
		Cmd_WriteVariables( f );

		mlook = (kbutton_t *)clgame.dllFuncs.KB_Find( "in_mlook" );
		jlook = (kbutton_t *)clgame.dllFuncs.KB_Find( "in_jlook" );

		if( mlook && ( mlook->state & 1 )) 
			FS_Printf( f, "+mlook\n" );

		if( jlook && ( jlook->state & 1 ))
			FS_Printf( f, "+jlook\n" );

		FS_Printf( f, "exec userconfig.cfg" );

		FS_Close( f );
	}
	else MsgDev( D_ERROR, "Couldn't write config.cfg.\n" );
}
开发者ID:ShaunNoWay,项目名称:xash3d,代码行数:40,代码来源:con_utils.c


示例13: R_CreateDetailTexturesList

void R_CreateDetailTexturesList( const char *filename )
{
	file_t		*detail_txt = NULL;
	const char	*detail_name, *texname;
	int		i;

	for( i = 0; i < cl.worldmodel->numtextures; i++ )
	{
		texname = cl.worldmodel->textures[i]->name;
		detail_name = R_DetailTextureForName( texname );
		if( !detail_name ) continue;

		// detailtexture detected
		if( detail_name )
		{
			if( !detail_txt ) detail_txt = FS_Open( filename, "w", false ); 
			if( !detail_txt )
			{
				MsgDev( D_ERROR, "Can't write %s\n", filename );
				break;
			}

			// store detailtexture description
			FS_Printf( detail_txt, "%s detail/%s 10.0 10.0\n", texname, detail_name );
		}
	}

	if( detail_txt ) FS_Close( detail_txt );
}
开发者ID:Xash3DLinux,项目名称:xash3dlinux,代码行数:29,代码来源:gl_rmisc.c


示例14: PmgCheckImyMidFileSize

/*****************************************************************************
 * FUNCTION
 *  PmgCheckImyMidFileSize
 * DESCRIPTION
 *  
 * PARAMETERS
 *  path        [?]     
 * RETURNS
 *  
 *****************************************************************************/
PMG_ADDFILE_ERRNO PmgCheckImyMidFileSize(S8 *path)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S8 *file_ext_p;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    file_ext_p = PmgGetFileExt(path);
    if (mmi_ucs2ncmp(file_ext_p, (S8*) L"mid", 3) == 0 || mmi_ucs2ncmp(file_ext_p, (S8*) L"MID", 3) == 0
        || mmi_ucs2ncmp(file_ext_p, (S8*) L"imy", 3) == 0 || mmi_ucs2ncmp(file_ext_p, (S8*) L"IMY", 3) == 0)
    {
        FS_HANDLE h;
        kal_uint32 file_size = 0;   /* U32 file_size=0; */

        h = FS_Open((U16*) path, FS_READ_ONLY);
        if (h)
        {
            FS_GetFileSize(h, &file_size);
            FS_Close(h);
        }
        else
        {
            return PMG_ADDFILE_ERR_UNKNOWN;
        }

        if (file_size > mdi_audio_get_midi_size_limit() )
        {
            return PMG_ADDFILE_ERR_FILE_TOO_LARGE;
        }
    }
    return PMG_ADDFILE_ERR_SUCCESS;
}
开发者ID:12019,项目名称:mtktest,代码行数:45,代码来源:ProfileMgr.c


示例15: PmgQueryFileExistBySlot

/*****************************************************************************
 * FUNCTION
 *  PmgQueryFileExistBySlot
 * DESCRIPTION
 *  
 * PARAMETERS
 *  slot        [IN]        
 * RETURNS
 *  
 *****************************************************************************/
BOOL PmgQueryFileExistBySlot(U8 slot)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S8 buf[MAX_EXT_MELODY_FULLNAME_WIDTH];
    FS_HANDLE h;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (slot > MAXIMUM_EXT_MELODY_NUM)
    {
        return MMI_FALSE;
    }

    PmgConstructPathFileName(
        buf,
        sizeof(buf),
        (S8*) gPmgExtMelodyInfo.info[slot].filepath,
        (S8*) gPmgExtMelodyInfo.info[slot].filename);
    h = FS_Open((WCHAR*)buf, FS_READ_ONLY);

    if (h > 0)
    {
        FS_Close(h);
        return MMI_TRUE;
    }
    else
    {
        return MMI_FALSE;
    }
}
开发者ID:12019,项目名称:mtktest,代码行数:43,代码来源:ProfileMgr.c


示例16: SDS_ReadNvramFileInRecord_sim

kal_int32 SDS_ReadNvramFileInRecord_sim(const kal_uint16 *pFilename, kal_uint8* pBuf, kal_uint32 bufLen)
{
   kal_int32 status;
   kal_uint32 readLen, fileLen;
   
   kal_int32 fd = FS_Open(pFilename, FS_OPEN_NO_DIR | FS_READ_ONLY);
   ASSERT(fd >= 0);
   
   status = FS_GetFileSize(fd, &fileLen);
   ASSERT(status >= 0);

   if(pBuf == NULL && bufLen == 0)
   {
      return fileLen;
   }

   if(bufLen < fileLen)
   {
      return SDS_BUF_TOO_SMALL;
   }
   
   status = FS_Read(fd, pBuf, fileLen, &readLen);
   ASSERT(status >= 0 && readLen == fileLen);
   
   FS_Close(fd);

   return readLen;
}
开发者ID:SSizemore,项目名称:MediaTek-HelioX10-Baseband,代码行数:28,代码来源:sds_nvram_support.c


示例17: lua_addCert

static int lua_addCert(lua_State *L)
{
	int argc = lua_gettop(L);
	#ifndef SKIP_ERROR_HANDLING
	if (argc != 1)  return luaL_error(L, "wrong number of arguments");
	#endif
	const char *text = luaL_checkstring(L, 1);
	fileStream fileHandle;
	if (strncmp("romfs:/",text,7) == 0){
		fileHandle.isRomfs = true;
		FILE* handle = fopen(text,"r");
		#ifndef SKIP_ERROR_HANDLING
		if (handle == NULL) return luaL_error(L, "file doesn't exist.");
		#endif
		fileHandle.handle = (u32)handle;
	}else{
		fileHandle.isRomfs = false;
		FS_Path filePath = fsMakePath(PATH_ASCII, text);
		FS_Archive script=(FS_Archive){ARCHIVE_SDMC, (FS_Path){PATH_EMPTY, 1, (u8*)""}};
		Result ret = FSUSER_OpenFileDirectly( &fileHandle.handle, script, filePath, FS_OPEN_READ, 0x00000000);
		#ifndef SKIP_ERROR_HANDLING
		if (ret) return luaL_error(L, "file doesn't exist.");
		#endif
	}
	u64 cert_size;
	u32 bytesRead;
	FS_GetSize(&fileHandle, &cert_size);
	u8* cert = (u8*)malloc(cert_size);
	FS_Read(&fileHandle, &bytesRead, 0, cert, cert_size);
	sslcAddTrustedRootCA(RootCertChain_contexthandle, cert, cert_size, NULL);
	free(cert);
	FS_Close(&fileHandle);
	return 0;
}
开发者ID:Rinnegatamante,项目名称:lpp-3ds,代码行数:34,代码来源:luaNetwork.cpp


示例18: Key_EnumCmds_f

void Key_EnumCmds_f( void )
{
	file_t	*f;

	FS_AllowDirectPaths( true );
	if( FS_FileExists( "../help.txt", false ))
	{
		Msg( "help.txt already exist\n" );
		FS_AllowDirectPaths( false );
		return;
	}

	f = FS_Open( "../help.txt", "w", false );
	if( f )
	{
		FS_Printf( f, "//=======================================================================\n");
		FS_Printf( f, "//\t\t\tCopyright XashXT Group %s ©\n", Q_timestamp( TIME_YEAR_ONLY ));
		FS_Printf( f, "//\t\thelp.txt - xash commands and console variables\n");
		FS_Printf( f, "//=======================================================================\n");

		FS_Printf( f, "\n\n\t\t\tconsole variables\n\n");
		Cvar_LookupVars( 0, NULL, f, Cmd_WriteHelp ); 
		FS_Printf( f, "\n\n\t\t\tconsole commands\n\n");
		Cmd_LookupCmds( NULL, f, Cmd_WriteHelp ); 
  		FS_Printf( f, "\n\n");
		FS_Close( f );
		Msg( "help.txt created\n" );
	}
	else MsgDev( D_ERROR, "Couldn't write help.txt.\n");
	FS_AllowDirectPaths( false );
}
开发者ID:ShaunNoWay,项目名称:xash3d,代码行数:31,代码来源:con_utils.c


示例19: GPSAppDataBackupWriteAttrFile

static GPSAppDataBackupError_t GPSAppDataBackupWriteAttrFile(kal_bool bNewCreate)
{
	FS_HANDLE file_handle;
	int result;
	kal_uint32 len;
	
	//create file
	file_handle = FS_Open((kal_uint16*)gGPSAppDataBackupAttrFileName, (bNewCreate == KAL_TRUE ? FS_CREATE : 0) | FS_READ_WRITE);
	if (file_handle < FS_NO_ERROR)
	{
		//fail to create
		return GPSAPP_DATABACKUP_ERROR_OPEN_FAIL;
	}
	//write
	result = FS_Write(file_handle, gGPSAppDataBackAttrCache, sizeof(gGPSAppDataBackAttrCache), &len);
	FS_Close(file_handle);
	if (result != FS_NO_ERROR || len != sizeof(gGPSAppDataBackAttrCache))
	{
		return GPSAPP_DATABACKUP_ERROR_WRITE_FAIL;
	}
	else
	{
		return GPSAPP_DATABACKUP_ERROR_NONE;
	}
}
开发者ID:robbie-cao,项目名称:tracker,代码行数:25,代码来源:gps_app_databackup.c


示例20: SV_StopDemoRecording

void SV_StopDemoRecording(client_t *client)
{
	prvm_prog_t *prog = SVVM_prog;
	sizebuf_t buf;
	unsigned char bufdata[64];

	if(client->sv_demo_file == NULL)
		return;
	
	buf.data = bufdata;
	buf.maxsize = sizeof(bufdata);
	SZ_Clear(&buf);
	MSG_WriteByte(&buf, svc_disconnect);
	SV_WriteDemoMessage(client, &buf, false);

	if (sv_autodemo_perclient_discardable.integer && PRVM_serveredictfloat(client->edict, discardabledemo))
	{
		FS_RemoveOnClose(client->sv_demo_file);
		Con_Printf("Stopped recording discardable demo for # %d (%s)\n", PRVM_NUM_FOR_EDICT(client->edict), client->netaddress);
	}
	else
		Con_Printf("Stopped recording demo for # %d (%s)\n", PRVM_NUM_FOR_EDICT(client->edict), client->netaddress);

	FS_Close(client->sv_demo_file);
	client->sv_demo_file = NULL;
}
开发者ID:paulvortex,项目名称:DpOmnicide,代码行数:26,代码来源:sv_demo.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FS_CreatePath函数代码示例发布时间:2022-05-30
下一篇:
C++ FS_CALL函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap