diff -r f345bda72bc4 -r 43e37759235e Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/_read_text_8cpp-source.html --- a/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/_read_text_8cpp-source.html Tue Mar 30 11:56:28 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ - -
-00001 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). -00002 // All rights reserved. -00003 // This component and the accompanying materials are made available -00004 // under the terms of "Eclipse Public License v1.0" -00005 // which accompanies this distribution, and is available -00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html". -00007 // -00008 // Initial Contributors: -00009 // Nokia Corporation - initial contribution. -00010 // -00011 // Contributors: -00012 // -00013 // Description: -00014 // This example writes the text "hello world!" from a resource file to the console -00015 // Use it as the basis of all examples which depend on BAFL -00016 // -00017 -00018 #include "CommonToResourceFilesEx.h" -00019 #include <readtext.rsg> -00020 -00021 // do the example -00022 LOCAL_C void doExampleL() -00023 { -00024 _LIT(KFormat,"%S\n"); -00025 -00026 // open resource file -00027 RResourceFile resourceFile; // resource file pointer -00028 // open file on the emulator(__WINS__ is defined for the Windows emulator) -00029 // (leave if error) -00030 #if defined(__WINS__) -00031 _LIT(KZSystemDataHelloRsc,"Z:\\Resource\\apps\\ReadText.rsc"); -00032 resourceFile.OpenL(fsSession, KZSystemDataHelloRsc); -00033 #endif -00034 -00035 // open file on the target phone -00036 // ( __EPOC32__ is defined for all target hardware platforms regardless of processor type/hardware architecture) -00037 #if defined(__EPOC32__) -00038 _LIT(KCSystemDataHelloRsc,"Z:\\Resource\\apps\\ReadText.rsc"); -00039 resourceFile.OpenL(fsSession, KCSystemDataHelloRsc); -00040 #endif -00041 -00042 HBufC8* dataBuffer=resourceFile.AllocReadLC(HELLO); -00043 TResourceReader reader; -00044 reader.SetBuffer(dataBuffer); -00045 TPtrC textdata = reader.ReadTPtrC(); -00046 -00047 // write string to test console -00048 console->Printf(KFormat, &textdata); -00049 // clean up data buffer -00050 CleanupStack::PopAndDestroy(); // finished with dataBuffer -00051 // close resource file -00052 resourceFile.Close(); // finished with resourceFile -00053 } -