00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __CommonStreamStore_H
00018 #define __CommonStreamStore_H
00019
00020 #include <e32cons.h>
00021 #include <f32file.h>
00022
00023
00024 LOCAL_D CConsoleBase* console;
00025 LOCAL_C void doExampleL();
00026 LOCAL_D RFs fsSession;
00027
00028
00029 LOCAL_C void callExampleL();
00030
00031 _LIT(KTxtStore,"STORE");
00032
00033 GLDEF_C TInt E32Main()
00034 {
00035 __UHEAP_MARK;
00036 CTrapCleanup* cleanup=CTrapCleanup::New();
00037 TRAPD(error,callExampleL());
00038 __ASSERT_ALWAYS(!error,User::Panic(KTxtStore,error));
00039 delete cleanup;
00040 __UHEAP_MARKEND;
00041 return 0;
00042 }
00043
00044 _LIT(KTxtExampleCode,"STORES Example Code");
00045 _LIT(KTxtConnectFailed,"file session connect failed: return code=%d");
00046 _LIT(KTxtFailed,"failed: leave code=%d");
00047 _LIT(KTxtOK,"ok");
00048 _LIT(KTxtPressAnyKey," [press any key]");
00049
00050 LOCAL_C void callExampleL()
00051 {
00052 console=Console::NewL(KTxtExampleCode,TSize(KConsFullScreen,KConsFullScreen));
00053 CleanupStack::PushL(console);
00054 TInt fsret = fsSession.Connect();
00055 if (fsret != KErrNone)
00056 {
00057 console->Printf(KTxtConnectFailed,fsret);
00058 User::Leave(fsret);
00059 }
00060 TRAPD(error,doExampleL());
00061 if (error) console->Printf(KTxtFailed, error);
00062 else console->Printf(KTxtOK);
00063 console->Printf(KTxtPressAnyKey);
00064 console->Getch();
00065 fsSession.Close();
00066 CleanupStack::PopAndDestroy();
00067 }
00068
00069 #endif