diff -r e8c1ea2c6496 -r 8758140453c0 localisation/apparchitecture/tef/TCmdLineExe.CPP --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/localisation/apparchitecture/tef/TCmdLineExe.CPP Thu Jan 21 12:53:44 2010 +0000 @@ -0,0 +1,84 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// TCmdLineExe.CPP - to test commandline APIS +// This exe is called in testCmdLinesAPIsL in T_CmdlnStep.CPP +// +// + + + +/** + @file + @internalComponent - Internal Symbian test code +*/ + +#include +#include +#include +#include +#include +#include "T_CmdlnStep.h" + + +// Global functions + +/** This function gets the file handle from the commandline object. It returns KErrNone when successful in reading + a file else it returns a system-wide error +*/ + +TInt DoReadFileL() + { + RFile file; + TBuf8<8> fileRead; + CApaCommandLine* cmdLine; + TInt ret(0); + ret = CApaCommandLine::GetCommandLineFromProcessEnvironment(cmdLine); + User::LeaveIfError(ret); + CleanupStack::PushL(cmdLine); + + cmdLine->GetFileByHandleL(file); + ret = file.Read(fileRead); + file.Close(); + CleanupStack::PopAndDestroy(cmdLine); + return ret; + } + +GLDEF_C TInt E32Main() + { + + + __UHEAP_MARK; + CTrapCleanup *cleanup=CTrapCleanup::New(); + + if(cleanup == NULL) + { + return KErrNoMemory; + } + TInt val(0); + + TRAPD(err,val= DoReadFileL()); + delete(cleanup); + __UHEAP_MARKEND; + + if((err==KErrNone) && (val ==KErrNone )) + { + return KFileHandleTestPassed; + } + else + { + return KErrGeneral; + } + + } +