Passing parameters to applications

As a new programmer, I expect this question is basic and has been asked many times before, so any direction or help would be appreciated.
In a windows application I wish to use spawnlp to start another application and pass it several (3) parameters.
I can get the spawn bit correct
spawnlp(P_WAIT, Filename, Filename, argv[1], argv[2], NULL);
but am unable to get the recipient application to read and use the arguments. Can someone provide the code to do this?
Any help appreciated.

Comments

  • : As a new programmer, I expect this question is basic and has been asked many times before, so any direction or help would be appreciated.
    : In a windows application I wish to use spawnlp to start another application and pass it several (3) parameters.
    : I can get the spawn bit correct
    : spawnlp(P_WAIT, Filename, Filename, argv[1], argv[2], NULL);
    : but am unable to get the recipient application to read and use the arguments. Can someone provide the code to do this?
    : Any help appreciated.
    :
    Does the application spawned actually use the parameters (i.e. it uses argv[1] and up)?

    Perhaps it is also possible to spawn a program with
    spawnlp(P_WAIT,"MyProgram MyParameters", , , , NULL);
    in which 'MyParameters' will be the same as argv[1].

    See ya,

    bilderbikkel

  • : : As a new programmer, I expect this question is basic and has been asked many times before, so any direction or help would be appreciated.
    : : In a windows application I wish to use spawnlp to start another application and pass it several (3) parameters.
    : : I can get the spawn bit correct
    : : spawnlp(P_WAIT, Filename, Filename, argv[1], argv[2], NULL);
    : : but am unable to get the recipient application to read and use the arguments. Can someone provide the code to do this?
    : : Any help appreciated.
    : :
    : Does the application spawned actually use the parameters (i.e. it uses argv[1] and up)?
    :
    : Perhaps it is also possible to spawn a program with
    : spawnlp(P_WAIT,"MyProgram MyParameters", , , , NULL);
    : in which 'MyParameters' will be the same as argv[1].
    :
    : See ya,
    :
    : bilderbikkel
    :
    :
    Thanks for reply.
    Yes, the child process will use all three items.
    In the child I use .. int main(int argc, char **argv) and assign argv[1] to a avariable using .. temp1 = argv[1]; but argv[1] etc. doesn't seem to pick the values being passed.

    thanks again..
  • Checking Google for 'spawnlp':

    spawnlp: This POSIX function is deprecated beginning in Visual C++ 2005. Use the ISO C++ conformant _spawnlp instead.

    I'd suggest trying _spawnlp :-).

    See ya,

    bilderbikkel

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories