how to call a unix shell script from a c program 
Author Message
 how to call a unix shell script from a c program

 Anyone out there is willing to shed some light on how to call a Unix shell
script for a c program.  Thanks in advance.

Martin Lazar




Sun, 30 Apr 2000 03:00:00 GMT  
 how to call a unix shell script from a c program

Quote:

>  Anyone out there is willing to shed some light on how to call a Unix shell
> script for a c program.  Thanks in advance.

Hi Marin Lazar,

You can send a string to the command processor of the underlying
operating system by using the "system()" function. If you want to
build the string from variable components, use the "sprintf()"
function to assemble it before calling "sustem()":
  sprintf( myCommand, "someProgOrScript %s %d", someString, someNumber
);
  system( myCommand );

Stephan
(initiator of the campaign against grumpiness in c.l.c)



Mon, 01 May 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. A C program that calls unix shell scripts

2. Calling a KORN shell script (AIX) from a C-program

3. Calling shell script from a C program..

4. unix shell script execution

5. From a Unix shell script to a C function

6. UNIX shell scripts/commands..??

7. How can i return a variable to a Unix shell script

8. Calling Shell scripts from C

9. Running a shell script from C program

10. C program input redirect in shell script

11. Convert Unix Shell Program to C

12. BOOKS HOW TO UNIX/PERL/C-SHELL PROGRAMMING???

 

 
Powered by phpBB® Forum Software