Thread: System Info
View Single Post
Old Feb 14th, 2005, 9:55 PM   #1
Da-Kid
Programmer
 
Join Date: Nov 2004
Posts: 47
Rep Power: 0 Da-Kid is on a distinguished road
System Info

#include <iostream>
#include <cstdlib>

using namespace std;

int main()
{

        system( "echo Date: `date`" );
        system( "echo Uptime: `uptime`" );
        system( "echo Name: `uname -n`" );
        system( "echo Kernel: `uname -r`" );
}
I run this program with the command ./sysinfo
But I want to be able to add flags for instance ./sysinfo -d prints only the date line, can someone tell me how to make that possible? And also I found a line in bash that displays the hdd space.
 df | awk '{ sum+=\$2/1024^2 }; END { printf (\"%dGb\", sum 
             )}
Can someone tell me how to turn that into C++ code?
Da-Kid is offline   Reply With Quote