Skip to content

Instantly share code, notes, and snippets.

@kazuho
Created March 30, 2019 07:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazuho/2d291582ac9ee76680447210adbc6982 to your computer and use it in GitHub Desktop.
Save kazuho/2d291582ac9ee76680447210adbc6982 to your computer and use it in GitHub Desktop.
/*
* 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