当前位置: 首页>>代码示例>>C++>>正文


C++ TFileText::Set方法代码示例

本文整理汇总了C++中TFileText::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ TFileText::Set方法的具体用法?C++ TFileText::Set怎么用?C++ TFileText::Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TFileText的用法示例。


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

示例1:

void CTap2MenuAppUi::ReadExceptions()
	{
	TInt err=KErrNone;
	iExceptions.Reset();
	if (BaflUtils::FileExists(CEikonEnv::Static()->FsSession(),KExceptionsPath)) //!!!!!!!!!!!!!!!!!!!!!!!!!!!
		{
		TBuf<255> val;
		TLex conv;
		TUint32 IntVal;
		RFile filesave;
		TBuf<255> t;
		TFileText ft;
		filesave.Open(CEikonEnv::Static()->FsSession(), KExceptionsPath, EFileRead);
		ft.Set(filesave);
		while (ft.Read(val)==KErrNone)
			{
			conv.Assign(val);
			conv.Val(IntVal,EHex);
			iExceptions.AppendL(TUid::Uid(IntVal));
			}
		filesave.Close();
		}
	else
		{
		TParse parse;
		CEikonEnv::Static()->FsSession().Parse(KExceptionsPath,parse);
		if (!BaflUtils::FolderExists(CEikonEnv::Static()->FsSession(),parse.DriveAndPath()))
			{
			CEikonEnv::Static()->FsSession().MkDirAll(parse.DriveAndPath());
			}
		}
	}
开发者ID:kolayuk,项目名称:Tap2Menu,代码行数:32,代码来源:Tap2MenuAppUi.cpp

示例2: ConstructL

void CSettings::ConstructL()
{
    RFs fs;
    RFile file;
    TFileText text;
    TLex lex;
    TBuf<256> buf;
    User::LeaveIfError(fs.Connect());
    if(file.Open(fs,_L("C:\\System\\Apps\\vcall\\times"),EFileRead) != KErrNone)
    {
        User::Panic(_L("Config file not open"),KErrNotFound);
    }
    text.Set(file);
    while(text.Read(buf) == KErrNone)
    {
        lex.Assign(buf);
        TInt val;
        lex.Val(val);//TODO: error handling
        iTimes.Append(val);
    }
    file.Close();
    //iTimes.SortSigned();//TODO: fix sort
    iTimer = CVTimer::NewL();
    iTimer->setTimes(iTimes);
}
开发者ID:Seikareikou,项目名称:symbian,代码行数:25,代码来源:settings.cpp

示例3: ReadConfigFileL

// -----------------------------------------------------------------------------
// CStartupAdaptationStubModel::ReadConfigFileL
//
// -----------------------------------------------------------------------------
//
void CStartupAdaptationStubModel::ReadConfigFileL()
    {
    RDEBUG( _L( "CStartupAdaptationStubModel::ReadConfigFileL." ) );

    RFs fs;
    User::LeaveIfError( fs.Connect() );
    CleanupClosePushL( fs );

    RFile file;
    User::LeaveIfError( file.Open( fs, KConfigFile, EFileShareReadersOnly ) );
    CleanupClosePushL( file );

    TFileText reader;
    reader.Set( file );

    TBuf<256> buf;
    TLex lex( buf );

    for ( TInt i = 0; i < KNumResponseLists; i++ )
        {
        User::LeaveIfError( reader.Read( buf ) );

        RDEBUG_1( _L( "CStartupAdaptationStubModel: Config line: %S." ), &buf );

        lex.Assign( buf );
        ReadStructuredListL(
            iResponses[ i ].iParts, lex, *( iResponses[ i ].iList ) );
        }

    CleanupStack::PopAndDestroy( 2 ); // file, fs

    RDEBUG( _L( "CStartupAdaptationStubModel::ReadConfigFileL finished." ) );
    }
开发者ID:cdaffara,项目名称:symbian-oss_adapt,代码行数:38,代码来源:StartupAdaptationStubModel.cpp

示例4: ReadHttpTypesFileL

void CHttpTypes::ReadHttpTypesFileL(const TDesC& aFileName)
{
	RFs fs;

#if EPOC_SDK >= 0x06000000
	User::LeaveIfError(fs.Connect());
	iHttpTypesArray = new (ELeave) CDesCArrayFlat(HTTP_TYPES_ARRAY_GRANURALITY);

	HBufC *config = NULL;
	// Need to TRAP leaves, because must close the fs (right).
	// Thus, no point in using the CleanupStack for config either.
	//
	TRAPD(err, config = UnicodeLoad::LoadL(fs, aFileName));
	if (err == KErrNone && config != NULL)
		{
		TLineBuffer buffer(config->Des());
		while (!buffer.EOB())
			{
			TPtrC line = buffer.ReadLine();
			if (line.Length() > 0)
				{
				TRAP(err, ParseTypeLineL(line));
				if (err != KErrNone)
					break;
				}
			}
		}
	delete config;
	User::LeaveIfError(err);

#else
	RFile cfg;
	TFileText cfgtxt;
	TBuf<256> buffer;

	User::LeaveIfError(fs.Connect());
	User::LeaveIfError(cfg.Open(fs,aFileName,EFileStreamText));

	iHttpTypesArray = new (ELeave) CDesCArrayFlat(HTTP_TYPES_ARRAY_GRANURALITY);
	
	cfgtxt.Set(cfg);
	User::LeaveIfError(cfgtxt.Seek(ESeekStart));
	
	cfgtxt.Read(buffer);
	while (buffer.Length() > 0)
	{
		ParseTypeLineL(buffer);
		cfgtxt.Read(buffer);
	}
	
	cfg.Close();
#endif
	iHttpTypesArray->Sort();

	fs.Close();
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:56,代码来源:ws_eng.cpp

示例5: LeaveIfError

 /*
  * Save Form data, function to be executed when save option is selected. 
  * Creates the second form which allows for selecting the category.
  */
 TBool CYPagesForm1::SaveFormDataL()
{  
    CAknPopupFieldText* popupFieldText = static_cast <CAknPopupFieldText*> (ControlOrNull(EYPagesPopup));
 	if (popupFieldText) {		
		TInt categoryIndex = popupFieldText->CurrentValueIndex();
		TBuf <30> KMyTextFile;
		KMyTextFile.Format(_L("D:\\YPages\\%d%d.txt"), iColor, categoryIndex);
		
		RFs fileServer;
 	    User :: LeaveIfError (fileServer.Connect());
 	    RFile file;
 	    User::LeaveIfError(file.Open(fileServer, KMyTextFile, EFileRead|EFileStreamText));
 	    CleanupClosePushL(file);
 	    
 	    TFileText fileText;
 	    fileText.Set(file);
 	    
 	    TBuf<100> buffer;
 	    buffer = _L("");

 	    RBuf rBuf;
 	    rBuf.Create(buffer);
 	    rBuf.CleanupClosePushL();
 	    
 	  
 	    TInt err = KErrNone;
 	    while(err != KErrEof) {
 			err = fileText.Read(buffer);
 	    
 			if ((err != KErrNone) && (err != KErrEof)) {
 				User :: Leave(err);
 			}
 			if (KErrNone == err) {
 				rBuf.ReAllocL(rBuf.Length() + buffer.Length()+2);
 				rBuf.Append(buffer);
 				rBuf.Append(_L("\n"));
 			}
 	    }
 	    CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(rBuf);
 	    dlg->PrepareLC(R_ABOUT_HEADING_PANE);
   	    dlg->SetHeaderTextL(_L(""));  
   	    dlg->RunLD();
 	    		     
 	    CleanupStack::PopAndDestroy(&rBuf);
 	    CleanupStack::PopAndDestroy(&file);
 	    
 	    fileServer.Close();

 	
 	}

        

 	return ETrue;
 }
开发者ID:pulkit110,项目名称:Yellow-Pages-Symbian,代码行数:59,代码来源:YPagesForm1.cpp

示例6: LocationRequestThread

/**
 * This is the main function for threads that connects and
 * disconnect from MLFW
 *
 * Function returns 0 if running of the test did not leave.
 *Otherwise the leave code is returned.
 **/
LOCAL_C TInt LocationRequestThread(TAny* aData)
{
    // Create cleanupstack for this thread
    CTrapCleanup* cleanup = CTrapCleanup::New();

    // No parameters to read, just start main function.

    HBufC* buf = HBufC::NewL(1024);

    TPtr ptr = buf->Des();

    // Run the actual test, and trap possible leave
    TRAPD(leave, LocationRequestThreadMainPartL(ptr));

    // Open connection to file server
    RFs fs;
    User::LeaveIfError(fs.Connect());

    TInt index = *((TInt*) aData);

    TBuf<30> errorFile;
    _LIT(KInfThread, "c:\\logs\\thread%derrinfo.txt");
    errorFile.Format(KInfThread, index);

    // Open log file
    RFile file;

    TInt err = file.Replace(fs,errorFile,EFileStreamText|EFileWrite);

    if (err != KErrNone)
        {
        User::Leave(err);
        }

    _LIT(KErrLeave, "*** This thread (thread %d) leave code: %d\r\n");
    ptr.AppendFormat(KErrLeave, index, leave);

    TFileText fileText;
    fileText.Set(file);

    fileText.Write(ptr);

    // Close log file
    file.Close();
    fs.Close();

    // Delete cleanup stack
    delete cleanup;

    // Exit this thread with leave code (KErrNone in successful case)
    User::Exit(leave);

    return 0;
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:61,代码来源:ctlbsclientpostp208.cpp

示例7: ShowL

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperViewContainer::ShowL( const TDesC& aString, TBool& aLast, const TBool& aFileOutput )
    {
    MDesCArray* itemList = iListbox->Model()->ItemTextArray();
    CDesCArray* itemArray = ( CDesCArray* ) itemList;

    itemArray->AppendL( aString );

    iListbox->HandleItemAdditionL();
    iListbox->SetCurrentItemIndex( iCount );
    iCount++;
    if ( aLast )
        {
        if (aFileOutput)
            {
            RFile file;
            RFs& fs = CEikonEnv::Static()->FsSession();
            TFileName fileName =_L("Layout_");

            TRect screenRect;
            AknLayoutUtils::LayoutMetricsRect(
                AknLayoutUtils::EApplicationWindow,
                screenRect );

            // Add screen dimensions
            TInt height = screenRect.Height();
            TInt width = screenRect.Width();
            fileName.AppendNum(height);
            fileName.Append('_');
            fileName.AppendNum(width);

            fileName.Append(_L(".txt"));

            TInt err=file.Open(fs,fileName,EFileStreamText|EFileWrite|EFileShareAny);
            if (err==KErrNotFound) // file does not exist - create it
                err=file.Create(fs,fileName,EFileStreamText|EFileWrite|EFileShareAny);
            else
                file.SetSize(0); //sweep the file
            TFileText textFile;
            textFile.Set(file);
            err = textFile.Seek(ESeekStart);
            if (err) User::InfoPrint(_L("File corrupted"));

            // Finally loop through all the entries:
            TInt idx = 0;
            for(;idx!=itemList->MdcaCount();idx++)
                {
                err = textFile.Write(itemList->MdcaPoint(idx));
                if (err) User::InfoPrint(_L("File corrupted"));
                }
            file.Close();
            }
        DrawNow();
        }
    }
开发者ID:mpvader,项目名称:qt,代码行数:58,代码来源:pm_mapperview.cpp

示例8: ReadConfigFileL

void CWebServerEnv::ReadConfigFileL(const TDesC& aConfigFileName)
//Function which reads and parse the confing file
{

	RFs fs;
#if EPOC_SDK >= 0x06000000
	User::LeaveIfError(fs.Connect());
	HBufC *config = NULL;
	// Need to TRAP leaves, because must close the fs (right).
	// Thus, no point in using the CleanupStack for config either.
	//
	TRAPD(err, config = UnicodeLoad::LoadL(fs, aConfigFileName));
	if (err == KErrNone && config != NULL)
		{
		TLineBuffer buffer(config->Des());
		while (!buffer.EOB())
			{
			TPtrC line = buffer.ReadLine();
			if (line.Length() > 0)
				{
				TRAP(err, ParseConfigLineL(fs, line));
				if (err != KErrNone)
					break;
				}
			}
		}
	delete config;
	fs.Close();
	User::LeaveIfError(err);
#else
	RFile cfg;
	TFileText cfgtxt;
	TBuf<256> buffer;

	User::LeaveIfError(fs.Connect());
	User::LeaveIfError(cfg.Open(fs,aConfigFileName,EFileStreamText));
	
	cfgtxt.Set(cfg);
	User::LeaveIfError(cfgtxt.Seek(ESeekStart));
	cfgtxt.Read(buffer);
	while (buffer.Length() > 0)
	{
		ParseConfigLineL(fs,buffer);
		cfgtxt.Read(buffer);
	}
	
	cfg.Close();

	fs.Close();
#endif
	CheckAndSetDefaultL();

}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:53,代码来源:ws_eng.cpp

示例9: SaveL

TInt CSpecialLog::SaveL(void)
{
	// Open file.
	TFileName filename;
	filename.Copy(KSpecialLogPath);
	filename.Append(KSpecialLogFile);
	RFile file;
	TInt result = file.Replace(* iFs, filename, EFileWrite);
	if (KErrNone != result)
	{
		return result;
	}

	// Write file
	TFileText fileText;
	fileText.Set(file);
	HBufC* buffer = HBufC::NewLC(KSpecialLogLineBufferSize);
	TPtr line = buffer->Des();

	line.Copy(KSpecialLogSection);					// Write section header.
	fileText.Write(line);

	for (TInt i = 0; i < iLogSpecial.Count(); i ++)	// Write all special log entries.
	{
		const RLogSpecial & entry = iLogSpecial[i];
		// Write key (text if defined, otherwise index)
		if (i < KNumSpecialLogKeys)
			line.Copy((const TUint16 *) KSpecialLogKeyText[i]);	// TODO: Fix the cast.
		else
			line.Num(i);

		line.Append(_L("="));
		// Write value.
		if (ESpecialLogInt == entry.iType)
			line.AppendNum(entry.iInt);
		else
			line.Append(* entry.iText);

		result = fileText.Write(line);
		if (result != KErrNone)
			break;
	}
	CleanupStack::PopAndDestroy(buffer);
	file.Close();

	if (KErrEof == result) result = KErrNone;

	iState = ESaved;

	// Bubble result of TFileText::Write().
	return result;
}
开发者ID:yindian,项目名称:fontrouter,代码行数:52,代码来源:DebugHelper.cpp

示例10: CallTestsQL

GLDEF_C void CallTestsQL(TInt aDrive)
//
// Call tests for remote drive
//
	{

	Test0(testq);
	
	testq.Printf(_L("This may take some time.  Please be patient...\n"));
	
	testq.Next(_L("Test remote drive with multiple sessions"));
	MultipleSessions(aDrive,testq);

	const TInt numberOfTests=10;
	
	TPtrC record[numberOfTests];
	
	TInt i=0;
	for (;i<numberOfTests;i++)
		{
		if (i%2)
			record[i].Set(_L("Hubble_Bubble"));
		else
			record[i].Set(_L("Toil_and_Trouble"));
		}
	
	testq.Next(_L("Create a file 'TEXTFILE.TXT' on the remote drive"));
	RFile f;
	TInt r=f.Replace(TheFs,_L("TEXTFILE.TXT"),0);
	testq(r==KErrNone);
	TFileText textFile;
	textFile.Set(f);
	
	testq.Next(_L("Write to 'TEXTFILE.TXT'"));
	
	for (i=0;i<numberOfTests;i++)
		{
		r=textFile.Write(record[i]);
		testq(r==KErrNone);
		testq.Printf(_L("Write %d completed OK\n"),i+1);
		}
	
	f.Close();

	RFile file1;
	r=file1.Open(TheFs,_L("Q:\\TEST\\T_FSRV.CPP"),EFileRead|EFileShareReadersOnly);
	testq(r==KErrNone);
	file1.Close();	

	}
开发者ID:SymbianSource,项目名称:oss.FCL.interim.QEMU,代码行数:50,代码来源:svphost.cpp

示例11: LoadPluginsL

void CCryptoPluginsLoader::LoadPluginsL()
{
    HBufC *configFileBuf = GetConfigFileNameL();
    CleanupStack::PushL(configFileBuf);
    TPtr configFile(configFileBuf->Des());

    RFs fs;
    User::LeaveIfError(fs.Connect());
    CleanupClosePushL(fs);

    RFile file;
    User::LeaveIfError(file.Open(fs, configFile, KEntryAttNormal));
    CleanupClosePushL(file);

    TFileText ft;
    ft.Set(file);
    TFileName line;

    User::LeaveIfError(ft.Read(line));

    //Load all the plugins
    do
    {
        TFileName filename;
        filename.Append(KPluginDir);
        filename.Append(line);

        //Load...
        RLibrary plugin;
        TInt err=plugin.Load(filename);
        if (err==KErrNone)
        {
            CleanupClosePushL(plugin);
            iPluginDllList.AppendL(plugin);
            CleanupStack::Pop(&plugin);
            iPluginNames.AppendL(line);
        }
    }
    while(ft.Read(line) == KErrNone);


    CleanupStack::PopAndDestroy(&file);
    CleanupStack::PopAndDestroy(&fs);
    CleanupStack::PopAndDestroy(configFileBuf);

    BuildPluginCharacteristicsL();
}
开发者ID:kuailexs,项目名称:symbiandump-os2,代码行数:47,代码来源:cryptopluginsloader.cpp

示例12: About

void CDesktopHotKeyAppUi::About()
	{
	TFileName filename;
	GetAppPath(filename);
	HBufC* textResource = StringLoader::LoadLC(R_ABOUT_FILE);
	filename.Append(textResource->Des());
	CleanupStack::PopAndDestroy(textResource);

	RFile file;
	TInt nErr = file.Open(CEikonEnv::Static()->FsSession(), filename, EFileRead
			| EFileShareAny);
	if (nErr != KErrNone)
		return;

	TFileText fileText;
	fileText.Set(file);
	TBuf<128> linePtr;
	HBufC* iText = NULL;

	while (fileText.Read(linePtr) == KErrNone)
		{
		if (iText!=NULL)
			{
			iText = iText->ReAllocL(iText->Length() + linePtr.Length() + 2);
			iText->Des().Append(linePtr);
			}
		else
			{
			iText = HBufC::NewL(linePtr.Length() + 2);
			iText->Des().Append(linePtr);
			}
		iText->Des().Append(CEditableText::ELineBreak);
		}
	file.Close();

	ShowModalAboutDlgL(R_ABOUT_DIALOG_TITLE,iText->Des());
	
	
	delete iText;
	}
开发者ID:flaithbheartaigh,项目名称:lemonplayer,代码行数:40,代码来源:DesktopHotKeyAppUi.cpp

示例13: ReadTextL

TBool CHelpContainer::ReadTextL()
	{
	TFileName filename;
	GetAppPath(filename);
	HBufC* textResource = StringLoader::LoadLC(R_HELP_FILE);
	filename.Append(textResource->Des());
	CleanupStack::PopAndDestroy(textResource);

	RFile file;
	TInt nErr = file.Open(CEikonEnv::Static()->FsSession(), filename, EFileRead
			| EFileShareAny);
	if (nErr)
		{
		return EFalse;
		}

	TFileText fileText;
	fileText.Set(file);
	TBuf<128> linePtr;

	while (fileText.Read(linePtr) == KErrNone)
		{
		if (iText)
			{
			iText = iText->ReAllocL(iText->Length() + linePtr.Length() + 2);
			iText->Des().Append(linePtr);
			}
		else
			{
			iText = HBufC::NewL(linePtr.Length() + 2);
			iText->Des().Append(linePtr);
			}
		iText->Des().Append(CEditableText::ELineBreak);
		}
	file.Close();

	return ETrue;
	}
开发者ID:flaithbheartaigh,项目名称:lemonplayer,代码行数:38,代码来源:HelpContainer.cpp

示例14: conv

void CTap2MenuAppUi::ReadSettings()
	{
	TInt err=KErrNone;
	iSettings.Reset();
	if (BaflUtils::FileExists(CEikonEnv::Static()->FsSession(),KSettingPath)) //!!!!!!!!!!!!!!!!!!!!!!!!!!!
		{
		TBuf<255> val;
		RFile filesave;
		TBuf<10> t;
		TFileText ft;
		TUint32 IntVal;
		filesave.Open(CEikonEnv::Static()->FsSession(), KSettingPath, EFileRead);
		ft.Set(filesave);
		while (ft.Read(val)==KErrNone)
			{
			TLex conv(val);
			conv.Val(IntVal,EDecimal);
			iSettings.Append(IntVal);
			}
		filesave.Close();
		}
	else
		{
		TParse parse;
		CEikonEnv::Static()->FsSession().Parse(KSettingPath,parse);
		if (!BaflUtils::FolderExists(CEikonEnv::Static()->FsSession(),parse.DriveAndPath()))
			{
			CEikonEnv::Static()->FsSession().MkDirAll(parse.DriveAndPath());
			}
		iSettings.Append(KPosXP);
		iSettings.Append(KPosYP);
		iSettings.Append(KPosXL);
		iSettings.Append(KPosYL);
		iSettings.Append(KSize);
		WriteSettings();
		}
	}
开发者ID:kolayuk,项目名称:Tap2Menu,代码行数:37,代码来源:Tap2MenuAppUi.cpp

示例15: LogIt

void TTimerLogger::LogIt(const TDesC& aComment)
	{
	TInt err = iFs.Connect();
	if(err == KErrNone)
		{
		iFs.MkDirAll(KFilePath);
		err = iFile.Open(iFs, KFileName, EFileWrite);
		if(err == KErrNotFound)
			{
			iFile.Create(iFs, KFileName, EFileWrite);
			iFile.Write(KTestHeader);
			iFile.Write(KTestLogs);
			}
		TFileText file;
	    file.Set(iFile);
		file.Write(aComment);
		iFile.Close();
		iFs.Close();
		}
	else	
		{
		User::InfoPrint(_L("Cannot write to file"));
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:24,代码来源:TimerLogger.cpp


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