×
Namespaces

Variants
Actions

Setting and Retrieving Process Arguments

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: vasant21 (30 May 2007)
Last edited: hamishwillee (25 Jul 2012)

command line argument can be passed to your process via the second argument of RProcess Create().

Example for sending Command Line Data:

void ProcessWithArgumentsL()
{
_LIT(KMyExeFile,"c:\\system\\programs\\ExampleProc.exe");
_LIT(KMyExeFileCmd,"first second third");
 
RProcess proc;
/* This will launch the MyProc.exe, passing the specified command line data to it */
 
User::LeaveIfError(proc.Create(KMyExeFile,KMyExeFileCmd));
// start the process running
proc.Resume();
 
}

This will pass the argument string first second third to the process created, which can then retrieve this argument by calling RProcess Command - Line()on an RProcess handle opened to itself, as the following shows:

Example for Getting Command Line Data:

TBuf<200> cmdLine;
User::CommandLine(cmdLine);
This page was last modified on 25 July 2012, at 07:14.
25 page views in the last 30 days.