Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Passing flag args to pterm, when pterm is spawned.: (3 Items)
   
Passing flag args to pterm, when pterm is spawned.  
I have a command file that executes the following command:

pterm -z on -C 1 ./MyApp

This has the effect of launching pterm, and then MyApp is launched within pterm by 'on' - in other words, it's as if one
 had typed into a pterm shell 

on -C 1 ./MyApp.

I can verify subsequently that all of the threads within 'MyApp' have been constrained to run on core 1 (of a multi-
core) CPU.

I have a number of applications I wish to launch using a programme that reads, from a text file: (1) the application 
name (2) the core to which is should be constrained to run.

I've constructed the equivalent text string, and pass this string to spawn() in the argv[] array.

The pterm is launched, but it displays an error message:

Cannot start program 'on -C 1 ' (No such file or directory)

If I try to supply additional args that are valid for pterm (e.g. pterm -z -r ), followed by 'on -C 1 ./MyApp' the error
 message is:

pterm: illegal option --

Does anyone know how I can use spawn to replicate the command string that I've shown to work from within a batch file?

Thanks in advance.
Re: Passing flag args to pterm, when pterm is spawned.  
Sounds like you are not constructing the argument vector correctly.

Try something like this:
char *args[]={"on", "-c1", "./MyApp", NULL};

Now pass args as the argv for spawn().
Re: Passing flag args to pterm, when pterm is spawned.  
Thank you for the reply. Passing the arguments individually worked.