Created
March 30, 2019 07:13
-
-
Save kazuho/2d291582ac9ee76680447210adbc6982 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* prints something like: | |
* sysname: Darwin | |
* release: 16.7.0 | |
* version: Darwin Kernel Version 16.7.0: Wed Feb 27 00:29:57 PST 2019; root:xnu-3789.73.43~1/RELEASE_X86_64 | |
* machine: x86_64 | |
*/ | |
#include <stdio.h> | |
#include <sys/utsname.h> | |
int main(void) | |
{ | |
struct utsname n; | |
uname(&n); | |
printf("sysname: %s\nrelease: %s\nversion: %s\nmachine: %s\n", n.sysname, n.release, n.version, n.machine); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment