wstrtod or watof Subroutine

Purpose

Converts a string to a double-precision floating-point.

Library

Standard C Library

Syntax

#include <wstring.h>

double wstrtod ( String,  Pointer)
wchar_t *String, **Pointer;

double watof (String)
wchar_t *String;

Description

The wstrtod subroutine returns a double-precision floating-point number that is converted from an wchar_t string pointed to by the String parameter. The system searches the String until it finds the first unrecognized character.

The wstrtod subroutine recognizes a string that starts with any number of white-space characters (defined by the iswspace subroutine), followed by an optional sign, a string of decimal digits that may include a decimal point, e or E, an optional sign or space, and an integer.

When the value of Pointer is not (wchar_t **) null, a pointer to the search terminating character is returned to the address indicated by Pointer. When the resulting number cannot be created, *Pointer is set to String and 0 (zero) is returned.

The watof (String) subroutine functions like the wstrtod (String (wchar_t **) null).

Parameters

Item Description
String Specifies the address of the string to scan.
Pointer Specifies the address at which the pointer to the terminating character is stored.

Error Codes

When the value causes overflow, HUGE_VAL (defined in the math.h file) is returned with the appropriate sign, and the errno global variable is set to ERANGE. When the value causes underflow, 0 is returned and the errno global variable is set to ERANGE.