Friday, 22 August 2014

OSA:System information c++

#include <iostream>
#include <sys/utsname.h>

using namespace std;

int main(){
struct utsname sysinfo;
uname(&sysinfo);
cout << "System Name: "<<sysinfo.sysname<<endl;
cout << "Host Name: "<<sysinfo.nodename<<endl;
cout << "Release(Kernel) Version: "<<sysinfo.release<<endl;
cout << "Kernel Build Timestamp: "<<sysinfo.version<<endl;
cout << "Machine Arch: "<<sysinfo.machine<<endl;
cout << "Domain Name: "<<sysinfo.domainname<<endl;
return 0;
}

2 comments:

  1. compile it on Turbo c;
    u will get an .exe file....
    if u do include all header files u might be able to run it on all platforms/os

    ReplyDelete