EnderUNIX tipsMail to My Friend , Home Page
[ C/C++ ]
"Get system related information via sysinfo()" - Metin KAYA - (2008-07-24 20:30:45) 
It is possible to get the system uptime, shared, buffered, free and total memory, number of processes, total swap space, etc... via sysinfo() system call. For instance:
struct sysinfo s_info;
printf("Uptime = %d seconds\n"
"RAM: total %d / free %d / shared %d\n"
"Memory in buffers = %d\n"
"Swap: total %d / free %d\n"
"Number of processes = %d\n",
To be able to use the code above, "linux/unistd.h" must be included in the source file. For detailed information: man sysinfo
Mail to My Friend , Home Page