pass parameter between two programs

Sep 4, 2012 at 4:37pm
closed account (28poGNh0)
Hiii everyone

I am sorry this title "cpp directory thing" was for another topic

I want when ,
I am running two of my programs,to get a paramerter(nbr,char or string) from the other program that sent It

any help could help
thank for reading ,your friend Techno01
Last edited on Sep 4, 2012 at 6:34pm
Sep 4, 2012 at 4:42pm
closed account (o3hC5Di1)
Hi there,

Do you mean command line arguments?

You can access those by doing:

1
2
3
4
5
6
7
int main( int argc, char* argv[]) // command line arguments passed to main
{
    if (argc >1)  //if more arguments than only the filename
    {
        for (int i=0; i<argc; i++) std::cout << argv[i] <<std::endl;  //print them
    }
}


Hope that helps,

All the best,
NwN
Sep 4, 2012 at 6:31pm
closed account (28poGNh0)
I think this is how to get the parameter ,if It is ,I want to know how to send the parameter

and thanks a lot reading the problem
Sep 4, 2012 at 6:39pm
closed account (o3hC5Di1)
This topic on stackoverflow deals with that:

http://stackoverflow.com/questions/2601831/program-to-call-other-programs

Hope that helps.

All the best,
NwN
Topic archived. No new replies allowed.