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

C++ LoadFromFile函数代码示例

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

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



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

示例1: AnsiString

LPDIRECTSOUNDBUFFER TSoundsManager::GetFromName(char *Name, bool Dynamic,
                                                           float *fSamplingRate)
{ // wyszukanie dŸwiêku w pamiêci albo wczytanie z pliku
    AnsiString file;
    if (Dynamic)
    { // próba wczytania z katalogu pojazdu
        file = Global::asCurrentDynamicPath + AnsiString(Name);
        if (FileExists(file))
            Name = file.c_str(); // nowa nazwa
        else
            Dynamic = false; // wczytanie z "sounds/"
    }
    TSoundContainer *Next = First;
    DWORD dwStatus;
    for (int i = 0; i < Count; i++)
    {
        if (strcmp(Name, Next->Name) == 0)
        {
            if (fSamplingRate)
                *fSamplingRate = Next->fSamplingRate; // czêstotliwoœæ
            return (Next->GetUnique(pDS));
            //      DSBuffers.
            /*
                Next->pDSBuffer[Next->Oldest]->Stop();
                Next->pDSBuffer[Next->Oldest]->SetCurrentPosition(0);
                if (Next->Oldest<Next->Concurrent-1)
                {
                    Next->Oldest++;
                    return (Next->pDSBuffer[Next->Oldest-1]);
                }
                else
                {
                    Next->Oldest= 0;
                    return (Next->pDSBuffer[Next->Concurrent-1]);
                };

       /*         for (int j=0; j<Next->Concurrent; j++)
                {

                    Next->pDSBuffer[j]->GetStatus(&dwStatus);
                    if ((dwStatus & DSBSTATUS_PLAYING) != DSBSTATUS_PLAYING)
                        return (Next->pDSBuffer[j]);
                }                                   */
        }
        else
            Next = Next->Next;
    };
    if (Dynamic) // wczytanie z katalogu pojazdu
        Next = LoadFromFile("", Name, 1);
    else
        Next = LoadFromFile(Directory, Name, 1);
    if (Next)
    { //
        if (fSamplingRate)
            *fSamplingRate = Next->fSamplingRate; // czêstotliwoœæ
        return Next->GetUnique(pDS);
    }
    ErrorLog("Missed sound: " + AnsiString(Name));
    return (NULL);
};
开发者ID:shaxbee,项目名称:maszyna,代码行数:60,代码来源:Sound.cpp


示例2: Shader

Shader::Shader(std::string vertexFile, std::string fragmentFile) : Shader()
{
	mVertex =glCreateShader(GL_VERTEX_SHADER);
	mFragment =glCreateShader(GL_FRAGMENT_SHADER);
	mProgram =glCreateProgram();
	
	LoadFromFile(FragmentShader, fragmentFile);
	LoadFromFile(VertexShader, vertexFile);
}
开发者ID:Fumasu,项目名称:MazeGame,代码行数:9,代码来源:Shader.cpp


示例3: Log

CMapzoneData::CMapzoneData(const char *szMapName)
{
    if (!LoadFromFile(szMapName))
    {
        Log("Unable to find map zones! Trying to create them...\n");
        saveZonFile(szMapName);//try making the zon file if the map has the entities
        LoadFromFile(szMapName);
    }
}
开发者ID:Ravennholm,项目名称:game,代码行数:9,代码来源:mapzones.cpp


示例4: LoadAndCreateShaderProgram

/*!
 Loads a shader program from a file and creates the related program
 @param vertex_file -  the file which stores the vertex shader code
 @param fragment_file -  the file which stores the fragment shader code
 @return - Gluint of the shader program
 */
GLuint LoadAndCreateShaderProgram(string vertex_file, string fragment_file)
{

    string vertex_source = LoadFromFile(vertex_file);
    string fragment_source= LoadFromFile(fragment_file);


    // create and return the pgoram.
    return CreateShaderProgram(vertex_source, fragment_source);

}
开发者ID:yuanfen1,项目名称:G_557_2015_YC,代码行数:17,代码来源:Shaders.cpp


示例5: m_userDataFolder

CFavouritesService::CFavouritesService(std::string userDataFolder) : m_userDataFolder(std::move(userDataFolder))
{
  CFileItemList items;
  std::string favourites = "special://xbmc/system/favourites.xml";
  if(XFILE::CFile::Exists(favourites))
    LoadFromFile(favourites, m_favourites);
  else
    CLog::Log(LOGDEBUG, "CFavourites::Load - no system favourites found, skipping");

  favourites = URIUtils::AddFileToFolder(m_userDataFolder, "favourites.xml");
  if(XFILE::CFile::Exists(favourites))
    LoadFromFile(favourites, m_favourites);
  else
    CLog::Log(LOGDEBUG, "CFavourites::Load - no userdata favourites found, skipping");
}
开发者ID:anaconda,项目名称:xbmc,代码行数:15,代码来源:FavouritesService.cpp


示例6: LoadRank

bool cPlayer::LoadFromDisk(cWorldPtr & a_World)
{
	LoadRank();

	// Load from the UUID file:
	if (LoadFromFile(GetUUIDFileName(m_UUID), a_World))
	{
		return true;
	}
	
	// Load from the offline UUID file, if allowed:
	AString OfflineUUID = cClientHandle::GenerateOfflineUUID(GetName());
	const char * OfflineUsage = " (unused)";
	if (cRoot::Get()->GetServer()->ShouldLoadOfflinePlayerData())
	{
		OfflineUsage = "";
		if (LoadFromFile(GetUUIDFileName(OfflineUUID), a_World))
		{
			return true;
		}
	}
	
	// Load from the old-style name-based file, if allowed:
	if (cRoot::Get()->GetServer()->ShouldLoadNamedPlayerData())
	{
		AString OldStyleFileName = Printf("players/%s.json", GetName().c_str());
		if (LoadFromFile(OldStyleFileName, a_World))
		{
			// Save in new format and remove the old file
			if (SaveToDisk())
			{
				cFile::Delete(OldStyleFileName);
			}
			return true;
		}
	}
	
	// None of the files loaded successfully
	LOG("Player data file not found for %s (%s, offline %s%s), will be reset to defaults.",
		GetName().c_str(), m_UUID.c_str(), OfflineUUID.c_str(), OfflineUsage
	);

	if (a_World == NULL)
	{
		a_World = cRoot::Get()->GetDefaultWorld();
	}
	return false;
}
开发者ID:cedeel,项目名称:MCServer,代码行数:48,代码来源:Player.cpp


示例7: LoadFromFile

NameGenerator::NameGenerator()
{
    //ctor
    LoadFromFile("data/letter_chances.txt");
    std::string key, value;
    for(auto it = m_values.begin(); it != m_values.end(); it++)
    {
        key = it->first;
        value = it->second;
        try
        {
            if(key.size() == 1)
            {
                m_first[key.at(0)] = std::stof(value);
            }
            if(key.size() == 2)
            {
                m_second[key.at(0)][key.at(1)] = std::stof(value);
            }
            if(key.size() == 3)
            {
                m_third[key.at(0)][key.at(1)][key.at(2)] = std::stof(value);
            }
        }
        catch(...)
        {
            std::cout << "Could not convert " << value << std::endl;
        }
    }
}
开发者ID:Panzareon,项目名称:RoguePG,代码行数:30,代码来源:NameGenerator.cpp


示例8: IsEditorMode

void Ide::LoadLastMain()
{
	bool editor = IsEditorMode();
	LoadFromFile(THISBACK(SerializeLastMain), ConfigFile("lastmain.cfg"));
	if(editor)
		main <<= Null;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:7,代码来源:Config.cpp


示例9: main

int main() {
	MyTree<int>* root = CreateEmptyTree<int>();
	LoadFromFile(root, "C:\\input.txt");
	Square(root);
	SaveToFile(root, "C:\\out.txt");
	DeleteTree(root);
}
开发者ID:GZNigmatzyanova,项目名称:KPFUExercises,代码行数:7,代码来源:Обход+дерева+стеком.cpp


示例10: Initialize

bool pawsConfigPopup::Initialize()
{
    if (!LoadFromFile("configpopup.xml"))
        return false;

    return true;
}
开发者ID:Chettie,项目名称:Eulora-client,代码行数:7,代码来源:pawsconfigpopup.cpp


示例11: OleRegisterServerDoc

/*
    constructor
    -----------

    if "szPath" is NULL then we create an untitled document and default object
    
    the type is "doctypeNew" if "lhDoc" is NULL and "doctypeEmbedded" if
    "lhDoc" is non NULL
    
    if "szPath" is non NULL we create a document of type "doctypeFromFile"
    and initialize it from file "szPath"
    
    if "lhDoc" is NULL then we call OleRegisterServerDoc() otherwise we
    just use "lhDoc" as our registration handle
*/
TOLEDocument::TOLEDocument (TOLEServer &server,
                            LHSERVERDOC lhDoc,
                            LPSTR       szPath,
                            BOOL        dirty)
{
  szName = 0;
  lpvtbl = &_vtbl;
  fRelease = FALSE;
  fDirty = dirty;

  server.pDocument = this;

  //
  // since we only have one object we can create it now...
  //
  pObject = new TOLEObject;

  if (szPath)
    LoadFromFile (szPath);

  else {
    SetDocumentName (UNNAMED_DOC);

    type = lhDoc ? doctypeEmbedded : doctypeNew;
  }

  if (lhDoc != 0)
    this->lhDoc = lhDoc;  // use registration handle we were given

  else
  	OleRegisterServerDoc (server.lhServer, szName, this, (LHSERVERDOC FAR *) &this->lhDoc);
}
开发者ID:LucasvBerkel,项目名称:TweedejaarsProject,代码行数:47,代码来源:DOCUMENT.CPP


示例12: LoadFromFile

Bitmap::Bitmap(const WCHAR *path) {
	data = NULL;
	xOffsets = NULL;
	yOffsets = NULL;
	
	LoadFromFile(path);
}
开发者ID:damianGray77,项目名称:SoftwareRenderer,代码行数:7,代码来源:Bitmap.cpp


示例13: Initialize

bool pawsConfigChatFilter::Initialize()
{
    if (!LoadFromFile("configchatfilter.xml"))
        return false;

    return true;
}
开发者ID:garinh,项目名称:planeshift,代码行数:7,代码来源:pawsconfigchatfilter.cpp


示例14: m_jazzPath

//-----------------------------------------------------------------------------------------------
ResourceStream::ResourceStream( const std::string& fileToOpenForReading, bool failSilently )
: m_jazzPath( fileToOpenForReading )
, m_startOfData( NULL )
, m_currentReadOffset( 0 )
, m_dataBytesAvailable( 0 )
, m_capacity( 0 )
, m_internalFormat( RESOURCE_STREAM_FORMAT_INVALID )
, m_currentIndentationDepth( 0 )
, m_consecutiveNewLineCount( 1 )
, m_justWroteBlockBegin( false )
, m_justWroteBlockEnd( false )
, m_integrity( RESOURCE_STREAM_INTEGRITY_VALID )
{
	// DEBUGGING - { int q = 5; } //ConsolePrintf( "ResourceStream is being constructed from JazzPath...\n" );
//	{ int q = 5; } //ConsolePrintf( "ResourceSteam being contructed from JazzPath, relative \"%s\" to marker #%d, resolved \"%s\".\n", fileToOpenForReading.GetRelativePathAsString().c_str(), fileToOpenForReading.GetFileFolderID(), fileToOpenForReading..c_str() );
	LoadFromFile( fileToOpenForReading );
//	{ int q = 5; } //ConsolePrintf( "Finished loading ResourceStream from file \"%s\"; resource stream contains %d bytes (capacity=%d).\n", m_jazzPath..c_str(), m_dataBytesAvailable, m_capacity );
	if( IsValid() )
	{
		{ int q = 5; } //ConsolePrintf( Rgba::GREY, "Loaded ResourceStream from file \"%s\"; resource stream contains %d bytes (capacity=%d).\n", m_jazzPath.c_str(), m_dataBytesAvailable, m_capacity );
	}
	else if( !failSilently )
	{
		{ int q = 5; } //ConsolePrintf( Rgba::RED, "FAILED TO LOAD ResourceStream from file \"%s\".\n", m_jazzPath..c_str() );
	}
}
开发者ID:SquirrelEiserloh,项目名称:Rules-of-Enragement,代码行数:27,代码来源:ResourceStream.cpp


示例15: Initialize

bool pawsConfigSound::Initialize()
{
    if ( ! LoadFromFile("configsound.xml"))
        return false;

    return true;
}
开发者ID:randomcoding,项目名称:PlaneShift-PSAI,代码行数:7,代码来源:pawsconfigsound.cpp


示例16:

INT CLcMdl2D::Create(void* p1, void* p2, void* p3, void* p4)
{
	char*	sFile = (char*)p1;

	if(FAILED(LoadFromFile(sFile)))
		return -1;


	char fname[128]={0};
	char fext [ 32]={0};
	LcStr_SplitPath(sFile, NULL, NULL, fname, fext);
	sprintf(m_sName, "%s%s", fname, fext);


	D3DXVECTOR3 vcMin;
	D3DXVECTOR3 vcMax;

	// Set Max and Min vertex Position
	D3DXComputeBoundingBox(	(D3DXVECTOR3*)m_pVtx
							, 4
							, D3DXGetFVFVertexSize(VtxDUV1::FVF)
							, &vcMin
							, &vcMax);

	m_BndInf.Set(vcMin, vcMax);

	return 0;
}
开发者ID:GALICSOFT,项目名称:glc220_src,代码行数:28,代码来源:LnMdl2D.cpp


示例17: LoadFromFile

bool SysConf::Reload()
{
	std::string& filename = m_Filename.empty() ? m_FilenameDefault : m_Filename;

	LoadFromFile(filename);
	return m_IsValid;
}
开发者ID:Alcaro,项目名称:dolphin,代码行数:7,代码来源:SysConf.cpp


示例18: MultiByteToWideChar

 int SImgX_STB::LoadFromFile( LPCSTR pszFileName )
 {
     wchar_t wszFileName[MAX_PATH+1];
     MultiByteToWideChar(CP_ACP,0,pszFileName,-1,wszFileName,MAX_PATH);
     if(GetLastError()==ERROR_INSUFFICIENT_BUFFER) return 0;
     return LoadFromFile(wszFileName);
 }
开发者ID:blueantst,项目名称:soui,代码行数:7,代码来源:imgdecoder-stb.cpp


示例19: LoadFromFile

bool CEpgDataLoader::Load(LPCTSTR pszFolder,HANDLE hAbortEvent)
{
	if (pszFolder==NULL)
		return false;

	FILETIME ftCurrent;
	TCHAR szFileMask[MAX_PATH];
	HANDLE hFind;
	WIN32_FIND_DATA fd;

	::GetSystemTimeAsFileTime(&ftCurrent);
	::PathCombine(szFileMask,pszFolder,TEXT("*_epg.dat"));
	hFind=::FindFirstFile(szFileMask,&fd);
	if (hFind==INVALID_HANDLE_VALUE)
		return false;
	do {
		if ((fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)==0
				&& ftCurrent-fd.ftLastWriteTime<FILETIME_HOUR*24*14
				&& ::lstrlen(pszFolder)+1+::lstrlen(fd.cFileName)<MAX_PATH) {
			TCHAR szFilePath[MAX_PATH];

			::PathCombine(szFilePath,pszFolder,fd.cFileName);
			LoadFromFile(szFilePath);
			if (hAbortEvent!=NULL
					&& ::WaitForSingleObject(hAbortEvent,0)==WAIT_OBJECT_0)
				break;
		}
	} while (::FindNextFile(hFind,&fd));
	::FindClose(hFind);
	return true;
}
开发者ID:ACUVE,项目名称:TVTest,代码行数:31,代码来源:EpgDataLoader.cpp


示例20: main

int main(int argc, char* argv[])
{
    LoadFromFile();
    printf("\n\n");
    LoadFromMemory();
    return 0;
}
开发者ID:C4rt,项目名称:MemoryModule,代码行数:7,代码来源:DllLoader.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ LoadGLTextures函数代码示例发布时间:2022-05-30
下一篇:
C++ LoadFont函数代码示例发布时间: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