/*
============================================================================
Name : Demo.c
Author : jwang
Version :
Copyright : Your copyright notice
Description : System information in C, Ansi-style
============================================================================
*/
#include <sys/utsname.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
int main(void) {
char computer[256];
struct utsname uts;
if(gethostname(computer, 255) != 0 || uname(&uts) < 0){
fprintf(stderr, "could not get host information\n");
}
printf("computer host name is %s\n", computer);
printf("system is %s on %s hardware\n", uts.sysname, uts.machine);
printf("nodeName is %s\n", uts.nodename);
printf("version is %s, %s\n", uts.release, uts.version);
return 0;
}
============================================================================
Name : Demo.c
Author : jwang
Version :
Copyright : Your copyright notice
Description : System information in C, Ansi-style
============================================================================
*/
#include <sys/utsname.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
int main(void) {
char computer[256];
struct utsname uts;
if(gethostname(computer, 255) != 0 || uname(&uts) < 0){
fprintf(stderr, "could not get host information\n");
}
printf("computer host name is %s\n", computer);
printf("system is %s on %s hardware\n", uts.sysname, uts.machine);
printf("nodeName is %s\n", uts.nodename);
printf("version is %s, %s\n", uts.release, uts.version);
return 0;
}