The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 05:23 AM
shell program jyotiardeshana Shell Programming and Scripting 4 01-03-2006 06:51 AM
Shell Program TexasGuy High Level Programming 3 03-12-2005 02:11 AM
C shell Program Reza Nazarian Shell Programming and Scripting 2 07-28-2003 03:52 PM
Urgent!! How to write a shell program to execute command to access internet? firebirdonfire UNIX for Dummies Questions & Answers 2 04-26-2001 12:16 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-29-2001
abdul abdul is offline
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
  #2 (permalink)  
Old 08-29-2001
rwb1959's Avatar
rwb1959 rwb1959 is offline
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[]);
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:27 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0