[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 2

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

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.

Related Information

The atof, atoff, strtod, strtof subroutine, scanf, fscanf, sscanf (scanf, fscanf, sscanf, or wsscanf Subroutine) subroutine, strtol, strtoul, atol, atoi (strtol, strtoul, strtoll, strtoull, or atoi Subroutine) subroutine, wstrtol, watol, watoi (wstrtol, watol, or watoi Subroutine) subroutine.

Subroutines Overview in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]