Its been three days I am struggling for mere 4-5 lines of code. Can anyone from you tell me why the following code behaves so strangely:
In the above code, numProcess++ is always called as the code progresses through the while condition block. But numProcess++ should not be called because myprocess.exe is not running.Code:// CConsoleBase* console = Console::NewL(_L("test"), TSize(KDefaultConsWidth, KDefaultConsHeight)); _LIT(KProcessName,"myprocess*"); TFindProcess find(KProcessName); TFullName name; TInt numProcess = 0; while (find.Next(name) == KErrNone) { numProcess++; } if(numProcess==0) { // process is not running }
If I add the following line at the start of the code then it never goes to the while loop and numProcess++ is not called.
// CConsoleBase* console = Console::NewL(_L("test"), TSize(KDefaultConsWidth, KDefaultConsHeight));
HOW CAN THIS BE POSSIBLE ????
Please try it yourself and you will be amazed!!!

Reply With Quote




