![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to use UNIX commands in C program | sundar.lsr | UNIX for Dummies Questions & Answers | 3 | 02-20-2008 04:37 AM |
| what are some different commands in c shell and korn shell?? | EquinoX | UNIX for Dummies Questions & Answers | 1 | 01-28-2008 09:14 PM |
| combining unix commands and awk program | Reza Nazarian | Shell Programming and Scripting | 2 | 05-19-2006 04:37 PM |
| How to run unix commands in a new shell inside a shell script? | hkapil | Shell Programming and Scripting | 2 | 01-04-2006 03:56 AM |
| KORN Shell - Spawn new shell with commands | frustrated1 | Shell Programming and Scripting | 2 | 04-20-2005 11:23 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
||||
|
||||
|
shell commands in c program
Hi All,
I want to include some shell commands in my c program in linux. please help.. thanks in advance esham |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Go through the man pages of popen and pclose. These allow you to execute commands and read/write from/to them.
|
|
#3
|
||||
|
||||
|
Also look at the man page for system(). It lets you run a command easily, but you can't do i/o to or from the command.
|
|
#4
|
||||
|
||||
|
you could also see the manual page of exevp .
Last edited by krhamidou; 10-16-2005 at 04:27 AM. |
|
#5
|
||||
|
||||
|
system() functions work fine.
But iam not able to give input for any commands for eg: can i give var=/home/esham ret=system("ls $var"); Please help.. |
|
#6
|
||||
|
||||
|
Esham,
You cannot assign "var=/home/esham" in C, you are talking about shell scripting. In C you would have variables like Code:
char var[]="/home/esham"; |
||||
| Google The UNIX and Linux Forums |