Find the answer to your Linux question:
Results 1 to 3 of 3
Can anyone tell me how to pass the variable (or) output result from one C program to another C++ program. (without using files). Urgent. Thanks....
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2005
    Location
    Bangalore
    Posts
    4

    C,C++ - Passing one program value/output to another program


    Can anyone tell me how to pass the variable (or) output result from one C program to another C++ program. (without using files).

    Urgent.
    Thanks.

  2. #2
    Linux Engineer
    Join Date
    Nov 2004
    Location
    Montreal, Canada
    Posts
    1,267

    Re: C,C++ - Passing one program value/output to another prog

    Quote Originally Posted by namasivayam
    Can anyone tell me how to pass the variable (or) output result from one C program to another C++ program. (without using files).
    Are the 2 program actively running, or the C "opens" the C++ program with some parameters?

    If the C++ is running,
    - file (easiest)
    - socket (not the fastest)
    - direct memory addressing (dangerous)

    if the C++ program isnt running, simply pass the parameter as you open it and get the (args[]) with the proper option you want to make it do
    \"Meditative mind\'s is like a vast ocean... whatever strikes the surface, the bottom stays calm\" - Dalai Lama
    \"Competition ultimatly comes down to one thing... a loser and a winner.\" - Ugo Deschamps

  3. #3
    Just Joined!
    Join Date
    Mar 2005
    Posts
    2
    Well, that's not sufficient info, but if you plan to run the two programs separately and you want to redirect the output, you can just pipe/redirect the output

    do something like

    program1 | program2 or program1 > program2, depending upon what your needs are

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •