According to the question \" How to get Linux distribution name and version? \", to get the linux distro name and version, this works:
lsb_release -a
You can simply use the function:
int uname(struct utsname *buf);
by including the header
#include
It already returns the name & version as a part of the structure:
struct utsname
{
char sysname[]; /* Operating system name (e.g., "Linux") */
char nodename[]; /* Name within "some implementation-defined network" */
char release[]; /* OS release (e.g., "2.6.28") */
char version[]; /* OS version */
char machine[]; /* Hardware identifier */
#ifdef _GNU_SOURCE
char domainname[]; /* NIS or YP domain name */
#endif
};
Am I missing something?