|
寫一個呼叫uname的程式,並列印utsname結構中所有欄位
#include <stdio.h>
#include <sys/utsname.h>
int main()
{
struct utsname buf;
uname (&buf);
printf ("sysname: %s\n", buf.sysname);
printf ("nodename: %s\n", buf.nodename);
printf ("release: %s\n", buf.release);
printf ("version: %s\n", buf.version);
printf ("machine: %s\n", buf.machine);
printf ("domainname: %s\n", buf.__domainname);
return 0;
}
Compile方法: gcc -o [.c程式碼檔名] [執行檔名]
Example: gcc -o xxx.c xxx |
|