Created
December 25, 2013 18:49
-
-
Save edenwaith/8125865 to your computer and use it in GitHub Desktop.
Check if OS X is running in 32 or 64-bit mode.
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
/* File: check64bit.c | |
* Description: Check if the running version of Mac OS X is 64-bit | |
* To Compile: gcc -Wall -o check64bit check64bit.c | |
* To run: ./check64bit | |
*/ | |
#include <stdio.h> | |
#include <string.h> | |
#include <sys/utsname.h> | |
int main(int argc, char *argv[]) | |
{ | |
int ret = 0; | |
struct utsname uname_info; | |
ret = uname(&uname_info); | |
if (ret == 0) | |
{ | |
printf("Uname Info\n"); | |
printf("Sysname : %s\n", uname_info.sysname); | |
printf("Nodename : %s\n", uname_info.nodename); | |
printf("Release : %s\n", uname_info.release); | |
printf("Version : %s\n", uname_info.version); | |
printf("Machine : %s\n", uname_info.machine); | |
if (strcmp(uname_info.machine, "x86_64") == 0) | |
{ | |
printf("You are running in 64-bit mode!\n"); | |
} | |
else | |
{ | |
printf("You are running in 32-bit mode.\n"); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment