#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?