Mac: 型号、处理器(module, processor )获
// Module
char buf[100];
size_t length = 100;
memset(buf, 0, length);
int intErr = 0;
intErr = sysctlbyname("hw.model", buf, &length, NULL, 0);
if (intErr != 0) {
cout << "Error in sysctlbyname(): " << intErr;
} else {
cout << "Hardware model: " << buf;
}
// Processor
char buf2[100];
size_t buflen2 = 100;
memset(buf2, 0, length2);
sysctlbyname("machdep.cpu.brand_string", &buf2, &buflen2, NULL, 0);
本文标题:Mac: 型号、处理器(module, processor )获
本文链接:https://www.haomeiwen.com/subject/ygablrtx.html
网友评论