Thread: System Call
View Single Post
  #4 (permalink)  
Old January 24th, 2005, 02:01 PM
Keith E. Cooper Keith E. Cooper is offline
Registered User
 
Join Date: Jan 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Keith E. Cooper
Default

As was stated earlier, what ever your command line can accept can go into the string passed to the system() call. So if the program you wish to invoke is in /home/me/bin, is named test1, takes an input file name for an argument, and you wish stdout to be written to a file, the string might look like this:

"/home/me/bin/test1 < myinputfile > myoutputfile"

Note that this isn't very flexible if the string were hard-coded: You must recompile if you change any options.

Reply With Quote