Connecting Tech Pros Worldwide Help | Site Map

Quick Question

  #1  
Old July 22nd, 2005, 07:06 AM
Carter
Guest
 
Posts: n/a
How do you make the output of a c++ program be interpreted as a UNIX
command? Example, what would a program that executed ls look like?
  #2  
Old July 22nd, 2005, 07:06 AM
Victor Bazarov
Guest
 
Posts: n/a

re: Quick Question


"Carter" <cjcastor@phreaker.net> wrote...[color=blue]
> How do you make the output of a c++ program be interpreted as a UNIX
> command? Example, what would a program that executed ls look like?[/color]

You should probably use 'system' function.


  #3  
Old July 22nd, 2005, 07:06 AM
Mike Wahler
Guest
 
Posts: n/a

re: Quick Question



"Carter" <cjcastor@phreaker.net> wrote in message
news:b7fc5708.0402031127.4d338b09@posting.google.c om...[color=blue]
> How do you make the output of a c++ program be interpreted as a UNIX
> command? Example, what would a program that executed ls look like?[/color]

#include <cstdlib>
#include <iostream>

int main()
{
int status = EXIT_SUCCESS;

if(system(NULL))
system("ls");
else
{
std::cerr << "Command processor not available\n";
status = EXIT_FAILURE;
}

return status;
}


-Mike


  #4  
Old July 22nd, 2005, 07:06 AM
Carter
Guest
 
Posts: n/a

re: Quick Question


thanks
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick question JustTrev answers 1 September 12th, 2009 04:52 PM
A quick question for IL and C# Brian answers 3 June 16th, 2006 02:35 PM
quick question on DDL? Rudy answers 2 November 19th, 2005 07:41 AM
public vs private access, quick question- z_learning_tester answers 6 November 16th, 2005 06:38 AM
Quick question -- script issue jack answers 1 July 19th, 2005 05:40 AM