LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Thread Tools
Old 02-17-2005, 04:12 PM   #1
boeroe
LQ Newbie
 
Registered: Feb 2005
Location: suriname
Distribution: suse
Posts: 3
Thanked: 0
make c-program that accepts shell commands and execute them


[Log in to get rid of this advertisement]
i am a student living in suriname ans a complete newbie to linux and c.
i have to write a c-program that accepts shell commands with parameters and executes them. the program has to use the spaces in the command to execute the commands. who can put me on the right track?
boeroe is offline     Reply With Quote
Old 02-17-2005, 05:30 PM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,497
Thanked: 44
Interesting man pages for your program:
man fgets
man system
Hko is offline     Reply With Quote
Old 02-17-2005, 10:48 PM   #3
boeroe
LQ Newbie
 
Registered: Feb 2005
Location: suriname
Distribution: suse
Posts: 3
Thanked: 0

Original Poster
thx i have read the manuel Will try to write something.
fgets let you read the command string and with system you can execute a shell command from within a c program. Have to read further about the forks..
boeroe is offline     Reply With Quote
Old 02-18-2005, 06:15 AM   #4
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,497
Thanked: 44
Reading this thread http://www.linuxquestions.org/questi...hreadid=288546
may help with fork().
Hko is offline     Reply With Quote
Old 02-18-2005, 09:41 AM   #5
boeroe
LQ Newbie
 
Registered: Feb 2005
Location: suriname
Distribution: suse
Posts: 3
Thanked: 0

Original Poster
thx had a quick look .Saw some usefull code..
boeroe is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i make commands execute when I turn on linux? versaulis Linux - Software 1 08-29-2004 07:51 PM
'make' & 'make install commands not recognised by shell gilbertt Linux - Software 4 05-04-2004 09:04 AM
Is it possible to make a Linux server execute a program on a WinXP system? Cichlasoma Linux - General 4 04-23-2004 07:00 AM
Shell commands in GNU make MadCactus Programming 2 02-19-2004 05:36 AM
Shell commands in GNU make? MadCactus Linux - Software 0 02-17-2004 04:11 PM


All times are GMT -5. The time now is 11:03 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration