The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
shell program nivas Shell Programming and Scripting 8 02-21-2008 01:23 AM
shell program jyotiardeshana Shell Programming and Scripting 4 01-03-2006 02:51 AM
Shell Program TexasGuy High Level Programming 3 03-11-2005 10:11 PM
C shell Program Reza Nazarian Shell Programming and Scripting 2 07-28-2003 11:52 AM
Urgent!! How to write a shell program to execute command to access internet? firebirdonfire UNIX for Dummies Questions & Answers 2 04-26-2001 08:16 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-29-2001
Registered User
 

Join Date: Aug 2001
Posts: 10
how to run a shell command from C program?

Hi mates,

i am trying to use the C execvp command to run a shell program like this:

.....
char input [25];
printf("enter your command");
scanf("%ds",input)
execvp input
....

Compilation is ok but when i run it raise the error :
Segmentation Error ...

your help will be appreciated.

Abdul
Forum Sponsor
  #2 (permalink)  
Old 08-29-2001
rwb1959's Avatar
Registered User
 

Join Date: Aug 2001
Location: Virginia, USA
Posts: 438
shell command from C

Check out then man pages for...
system(3) and popen(3)

Typically you would "exec" after a fork()
call. While execvp can work, you may have
some issue with the conversion of the
"input" into an appropriate form for the
call.
int execvp( const char *file, char *const argv[]);
Google The UNIX and Linux Forums
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:10 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0