hiii!!
i want to get system info like up time, no of process etc.
for up time i got the got from net but it is giving me error. i.e.
error: storage size of ‘sys_info’ isn’t known
following is the code i m using
Code:
void sysinfo()
{
int days, hours, mins;
struct sysinfo sys_info;
if(sysinfo(&sys_info) != 0)
perror("sysinfo");
// Uptime
days = sys_info.uptime / 86400;
hours = (sys_info.uptime / 3600) - (days * 24);
mins = (sys_info.uptime / 60) - (days * 1440) - (hours * 60);
printf("Uptime: %ddays, %dhours, %dminutes, %ldseconds\n",
days, hours, mins, sys_info.uptime % 60);
}
please tell whats wrong with the code? am i doing mistake somewhere??
Regards!