Created
June 4, 2013 22:42
-
-
Save shelling/5710267 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <sys/types.h> | |
| #include <sys/sysctl.h> | |
| char * | |
| cpu_name() { | |
| size_t buffer_size = 100; | |
| char * buffer = malloc(sizeof(char) * buffer_size); | |
| sysctlbyname("machdep.cpu.brand_string", buffer, &buffer_size, NULL, 0); | |
| return buffer; | |
| } | |
| int main() { | |
| printf("%s\n", cpu_name()); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment