![]() |
| | #1 |
| Registered User Join Date: Sep 2003
Posts: 17
| Using Variables with th 'System' command 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 | |
| | #2 |
| End Of Line 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 | |
| | #3 |
| Registered User Join Date: Sep 2003
Posts: 17
| Thanks a lot
__________________ A Man can be whatever he wants to be |
| dapernia is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
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 |