'programming/C_C++'에 해당되는 글 279건

  1. 2013.03.05 utsname

utsname

programming/C_C++ 2013. 3. 5. 20:17
반응형

 

 

NAME
     utsname.h, utsname - system name structure

 

SYNOPSIS

     #include <sys/utsname.h>

 

DESCRIPTION

     The <sys/utsname.h> header defines  the  structure  utsname, which includes the following members:

     char sysname[]      /* name of this implementation of the operating system */
     char nodename[]     /* name of this node within an implementation-defined communications network */
     char release[]      /* current release level of this implementation */
     char version[]      /* current version level of this release */
     char machine[]      /* name of the hardware type on which the system is running */

     The character arrays are of unspecified size, but  the  data stored in them is terminated by a null byte.

 

ATTRIBUTES
     See attributes(5) for descriptions of the  following  attributes:

 

SEE ALSO
     uname(2), attributes(5), standards(5)

 

 

 

----------------------------------------

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/utsname.h>

int main(int argc, char *argv[])
{

         struct utsname ubuf;
         uname(&ubuf);

         fprintf(stdout, "%s\n", ubuf.sysname);
         fprintf(stdout, "%s\n", ubuf.nodename);
         fprintf(stdout, "%s\n", ubuf.release);
         fprintf(stdout, "%s\n", ubuf.version);
         fprintf(stdout, "%s\n", ubuf.machine);

}


----------------------------------------

 

반응형
Posted by 공간사랑
,