Contents

withNumber(const char *, unsigned int)

Creates and initializes an instance of OSNumber with an unsigned integer value represented as a C string.

Declaration

static OSNumber * withNumber( 
 const char *valueString, 
 unsigned intnumberOfBits);

Parameters

  • valueString:

    A C string representing a numeric value for the OSNumber to store.

  • numberOfBits:

    The number of bits to limit storage to.

Return Value

An instance of OSNumber with a reference count of 1; NULL on failure.

Overview

This function does not work in I/O Kit versions prior to 8.0 (OS X 10.4). In I/O Kit version 8.0 and later, it works but is limited to parsing unsigned 32 bit quantities. The format of the C string may be decimal, hexadecimal ("0x" prefix), binary ("0b" prefix), or octal ("0" prefix).

The parsed value is masked to the provided numberOfBits when the OSNumber object is initialized.

You can change the value of an OSNumber later using setValue and addValue, but you can't change the bit size.

See Also

Miscellaneous