C Board  

Go Back   C Board > Platform Specific Boards > Linux Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 09-15-2003, 02:25 PM   #1
Registered User
 
Join Date: Sep 2003
Posts: 17
Using Variables with th 'System' command

Hi friends:

I have a tiny problem.
I want to graph some data i have stored in a file with the RRDtool program. This RRDTooll program works with shell commands:
rrdtool create test.rrd \
--start 920804400 \
DS:speed:COUNTER:600:U:U RRA \

etc, etc

Now, I want to make a C program to graph these data. But i don't know how to add variables with the system command
system("rrdtool create test.rrd --start %s ...",a);

How can i do that in C. or How could i do that in a shell script????

Please Help me!
__________________
A Man can be whatever he wants to
be
dapernia is offline   Reply With Quote
Old 09-15-2003, 03:52 PM   #2
End Of Line
 
Hammer's Avatar
 
Join Date: Apr 2002
Posts: 6,240
Use a buffer to hold the string, something like:
char buf[1024];
Put you commands in there (maybe using strcpy(), sprintf() etc), then call system(buf);

Alternatively, read the FAQ
__________________
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
Hammer is offline   Reply With Quote
Old 09-15-2003, 05:11 PM   #3
Registered User
 
Join Date: Sep 2003
Posts: 17
Talking

Thanks a lot
__________________
A Man can be whatever he wants to
be
dapernia is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
the system command happyclown C Programming 7 01-02-2009 07:14 AM
System() call - setting environment in a command prompt and then executing an exe lazyme C Programming 6 07-21-2008 03:10 AM
The C system command with long filenames in windowsXP esbo C Programming 30 09-12-2006 07:06 PM
using system command results in a program finnepower Windows Programming 6 06-10-2005 08:58 AM
System Calls && Variables Okiesmokie C++ Programming 6 03-06-2002 09:10 PM


All times are GMT -6. The time now is 05:50 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22