Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

informatin about os

Status
Not open for further replies.

huskers

Programmer
Jan 29, 2002
75
US
Hi,

Are there any special variables in C which give information about machine name, os, platform etc.

Thanks
 
there is a function called 'uname' which will give ypu the info you require
 
Where is that function??? I believe the question was on an ANSII function, not something specific since the need is to know what kind of system you're on. [red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
Seems to be a POSIX function.
It exists on AIX and Solaris.
So maybe on any UNIXes.
As for windows ... who can say ?

The AIX man page states:
Code:
uname(2)                                                           uname(2)

NAME
     uname(), setuname() - get information about computer system; set node
     name (system name)

SYNOPSIS
     #include <sys/utsname.h>

     int uname(struct utsname *name);

     int setuname(const char *name, size_t namelen);

DESCRIPTION
   uname()
     The uname() system call places information identifying the computer
     system in the utsname structure pointed to by name.

     The utsname structure, defined in <sys/utsname.h>, is set up as
     follows:

          #define UTSLEN  9
          #define SNLEN  15

          char sysname[UTSLEN];
          char nodename[UTSLEN];
          char release[UTSLEN];
          char version[UTSLEN];
          char machine[UTSLEN];
          char idnumber[SNLEN];

<skip>
<skip>
<skip>

STANDARDS CONFORMANCE
     uname(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top