Thread: output of one c program in another

  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    24

    output of one c program in another

    I have written a c program which consists of a decision
    making statement.The arguments which have to be input
    are currently a function's return value but i need to
    use another program's output as it's argument .
    It involves running the 2nd program,getting its output and
    then using it in the 1st . This has to be done
    iteratively till there is a satisfactory output from the
    2nd .How can i do this?

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    Check out popen().
    If you understand what you're doing, you're not learning anything.

  3. #3
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Other solutions: Pipes on the command line.... fork()ing and exec()ing on *nix systems..... CreateProcess() and I think CreatePipe() on Windows.

  4. #4
    Registered User
    Join Date
    Jun 2007
    Posts
    24
    thanks for the reply.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. calling an external program + capture output?
    By cyberfish in forum C++ Programming
    Replies: 4
    Last Post: 03-21-2008, 12:49 AM
  2. program looping with final output
    By hebali in forum C Programming
    Replies: 24
    Last Post: 02-28-2008, 10:58 AM
  3. Unusual program Output, Help
    By capvirgo in forum C Programming
    Replies: 8
    Last Post: 02-06-2008, 03:13 AM
  4. Redirecting program output straight to an edit control
    By bennyandthejets in forum C++ Programming
    Replies: 5
    Last Post: 07-05-2004, 08:25 AM
  5. Program Output
    By lavon in forum C Programming
    Replies: 1
    Last Post: 03-19-2002, 10:32 PM