LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 06-06-2005, 03:52 AM   #1
alaios
Senior Member
 
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,203

Rep: Reputation: 45
execute command from c code


Hi i want to execute some system commands from c code.. I know about the execv* family commands but still i dont know how to use them for executing the following thing


tc qdisc change dev $DEV parent 3:20 gred limit 34567 min 39222 max 78644 burst 64 avpkt 1024 bandwidth 6000 DP 1 probability 0.001 prio 1

Any good suggestion how to use the execv command to execute it properly?
Thx
 
Old 06-06-2005, 04:18 AM   #2
freegianghu
Member
 
Registered: Oct 2004
Location: somewhere in the street
Distribution: Window$
Posts: 192

Rep: Reputation: 30
Re: execute command from c code

Quote:
Originally posted by alaios
Hi i want to execute some system commands from c code.. I know about the execv* family commands but still i dont know how to use them for executing the following thing


tc qdisc change dev $DEV parent 3:20 gred limit 34567 min 39222 max 78644 burst 64 avpkt 1024 bandwidth 6000 DP 1 probability 0.001 prio 1

Any good suggestion how to use the execv command to execute it properly?
Thx
Code:
char *args[] = {
   "qdisc",
   "change",
   "dev",
   "eth4", //"$DEV",
   "parent",
   "3:20",
   "gred",
   "limit",
   "34567",
   "min",
   "39222",
   "max",
   "78644",
   "burst",
   "64",
   "avpkt",
   "1024",
   "bandwidth",
   "6000",
   "DP",
   "1",
   "probability",
   "0.001",
   "prio",
   "1",
   NULL};

   execv("/sbin/tc", args);
 
Old 06-06-2005, 04:54 AM   #3
junaid18183
Member
 
Registered: Mar 2005
Location: India
Distribution: RedHat 9.0 and EL
Posts: 31

Rep: Reputation: 15
hi,
you can use
system e.g.


Code:
system("clear")
Regards
junaid
 
Old 06-06-2005, 05:26 AM   #4
alaios
Senior Member
 
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,203

Original Poster
Rep: Reputation: 45
thx mate
 
  


Reply



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
C program code to execute linux-command supermichou_fr Linux - Software 4 08-01-2012 08:25 AM
execute shell command inside of c code? khucinx Programming 6 10-26-2010 09:30 PM
Code for an os memory manager to execute apps NCC-1701&NCC-1701-D Programming 1 08-17-2005 10:06 PM
how to execute shell script with c code? khucinx Programming 3 05-04-2004 02:54 PM
How to compile and execute Doom 1.10 source code sharathkv Linux - Newbie 1 08-26-2003 03:01 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:06 PM.

Main Menu
Advertisement
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
Twitter: @linuxquestions
Open Source Consulting | Domain Registration