Linux version
From Teknologisk videncenter
Checking the Linux version in C-code
#include <stdio.h>
#include <sys/utsname.h>
int main( void ) {
struct utsname u;
if ( uname( &u ) != 0 ) {
perror("Kald til uname(2) fejlede..");
}
printf("OS name.......: %s\n", u.sysname);
printf("Nodename......: %s\n", u.nodename);
printf("Release.......: %s\n", u.release);
printf("Version.......: %s\n", u.version);
printf("Machine.......: %s\n", u.machine);
#ifdef _GNU_SOURCE
printf("Domainnam.e...: %s\n", u.domainname);
#endif
return(0);
}