[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


uname

Gets information about the system you are using.

Compatibility:

This function is compatible with the following targets:

ANSI
BeOS
EMB/RTOS

Mac OS

Palm OS

Win32


Prototype:
#include <utsname.h>
int uname(struct utsname *name);
Parameters:

Parameters for this facility are:

name  
struct utsname *  
A struct to store system information  

Remarks:

This function gets information on the Macintosh you're using and puts the information in the structure that name points to. The structure contains the fields listed in Table 33.1. All the fields are null-terminated strings.

The utsname structure:

This field
is
sysnam  
The operating system  
nodename  
The sharing node name.  
release  
The release number of system software.  
version  
The minor release numbers of the system software version.  
machine  
The type of the machine that you are using.  

Return:

If it is successful, uname() returns zero. If it encounters an error, uname() returns -1 and sets errno.

See Also:

"fstat"

"stat"

Example of uname() usage.:
#include <stdio.h>
#include <utsname.h>

int main(void)
{
	struct utsname name;
	
	uname(&name);
	
	printf("Operating System: %s\n", name.sysname);
	printf("Node Name:        %s\n", name.nodename);
	printf("Release:          %s\n", name.release);
	printf("Version:          %s\n", name.version);
	printf("Machine:          %s\n", name.machine);

	return 0;
}

This application could print the following:
Operating System: MacOS
Node Name:        Ron's G4
Release:          9
Version:          3
Machine:            Power Macintosh
This machine is a Power Macintosh running Version 9 of the MacOS. The Macintosh Name field of the File Sharing control panel contains "Ron's G4"


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 16, 2000