Languages

Menu
Sites
Language
How to pass command line arguments to a native application

Hi All,

I am trying to pass and then parse the command line arguments to a native application. I will be launching my application from command prompt (SDB). Would like to pass arguments, parse them in the application and then use it. I know in OspMain we can do this to get the argumetns,

for (int i = 0; i < argc; i++)
{
pArgs->Add(*(new String(pArgv[i])));
AppLog("index : %d, argument : %s", i, pArgv[i]);
}

But what I have observed is, the argc count and the argv array is not proper or I am missing something to understand. Even if I launch application without any arguments, the argc shows the value as 6. Howcome? If I pass two arguments, then the argc count is 8. The values of them will be as follows

launch_app appName "test1" "test2"

 

argc = 8

argv[0] = appName -> as expected

argv[1] = some junk characters

argv[2] =  test1

and it prints some more junk characters for the rest. Why is it so? In Windows, if we pass 2 arguments then argc will be 3, first is the appName and the rest is the arguments passed. But in Tizen it is not so? Am I missing something here?

 

Any Tizen documentation that points to this or explains this?

Please help me understanding this. Thanks in advance.

Responses

1 Replies
Alex Ashirov

Hi,

You can take a look at the following topic:

https://developer.tizen.org/forums/native-application-development/how-pass-arguments-tizen-native-application

But it seems that the problem is still not solved.