*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> wcstod (3)              



NAME    [Toc]    [Back]

       wcstod  - Convert a wide-character string to a double-precision

SYNOPSIS    [Toc]    [Back]

       #include <wchar.h>

       double wcstod(
               const wchar_t *ws,
               wchar_t **endptr );

LIBRARY    [Toc]    [Back]

       Standard C Library (libc)

STANDARDS    [Toc]    [Back]

       Interfaces documented on this reference  page  conform  to
       industry standards as follows:

       wcstod(): XSH5.0

       Refer to the standards(5) reference page for more information
 about industry standards and associated tags.

PARAMETERS    [Toc]    [Back]

       Points to the wide-character string  to  be  converted  to
       double-precision   floating-point   value.   Points  to  a
       pointer in which the wcstod() function stores the position
       of  the  final wide-character segment of the string, which
       contains unrecognized characters and the null  terminator.

DESCRIPTION    [Toc]    [Back]

       The  wcstod() function converts the initial portion of the
       wide-character string pointed to by the ws parameter to  a
       double-precision  floating-point  value.  The  input widecharacter
 string is first broken down into three parts: an
       initial  (possibly  empty)  sequence  of white-space widecharacter
 codes (as specified by the iswspace() function);
       a  subject  sequence  interpreted as a floating-point constant;
 and a final wide-character string of  one  or  more
       unrecognized wide-character codes, including the terminating
 null wide character. The subject sequence is then  (if
       possible)   converted   to  a  floating-point  number  and
       returned as the result of the wcstod() function.

       The subject sequence is expected to consist of an optional
       +  (plus  sign)  or - (minus sign), a nonempty sequence of
       digits (which may  contain  a  radix  character),  and  an
       optional  exponent.  The exponent consists of e or E, followed
 by an optional sign, followed by one or more decimal
       digits. The subject sequence is the longest initial subsequence
 of the input wide-character string  (starting  with
       the  first  nonwhite-space wide-character code) that is of
       the expected form. The subject sequence contains no  widecharacter
  codes  if  the  input  wide-character string is
       empty or consists entirely of  white-space  wide-character
       codes,  or if the first nonwhite-space wide-character code
       is other than a sign, a digit, or a radix character.

       If the subject sequence is valid, the  sequence  of  widecharacter
  codes,  starting  with the first digit or radix
       character (whichever occurs first), is  interpreted  as  a
       floating-point    or    double-precision    floating-point
       constant.  The locale's  radix  character  is  treated  as
       equivalent  to  the  . (period) within floating-point constants
 in the C locale. If neither an  exponent  or  radix
       character  appears, a radix character is assumed to follow
       the last digit in the wide-character string. If  the  subject
  sequence  begins with - ( a minus sign), the conversion
 value is negated. The radix character  is  determined
       by  the  LC_NUMERIC  category  in  the  program's  current
       locale.  In the C locale, or in a locale where  the  radix
       character  is  not  defined,  the  radix  character is a .

       The wcstod() function stores a pointer to the final  widecharacter
  segment  of the string (starting with the first
       invalid character) in the object pointed to by the  endptr
       parameter,  unless the endptr parameter is a null pointer.

RETURN VALUES    [Toc]    [Back]

       The wcstod() function returns the  converted  value  of  a
       double-precision floating-point value if a valid floatingpoint
 constant is found. If the converted value is outside
       the  range of representable values (either too high or too
       low), the function returns plus or minus HUGE_VAL and sets
       errno  to  [ERANGE].  If  the  converted value would cause
       underflow, the function returns 0 (zero) and sets errno to
       [ERANGE].  If  the  subject  sequence is empty or does not
       have the expected form, the function performs  no  conversion
 and returns 0 (zero).  In this case, the value specified
 by the ws parameter is stored in the  object  pointed
       to  by  the  endptr  parameter,  provided  that the endptr
       parameter is not a null pointer.

       Since the wcstod() function returns 0 (zero)  or  HUGE_VAL
       in  the  event of an error and these values are also valid
       returns if the wcstod() function is  successful,  applications
 should set errno to 0 (zero) before each call to the
       wcstod() function and check errno after each  return  from
       the function. If errno is nonzero after a return, an error
       occurred. Additionally, if 0 (zero) is returned,  applications
 should check if the endptr parameter equals the nptr
       parameter. In  this  case,  there  was  no  valid  subject

ERRORS    [Toc]    [Back]

       If  the  following condition occurs, the wcstod() function
       sets errno to the corresponding value: The converted value
       would  cause  underflow or, if outside the range of representable
 values, overflow.

SEE ALSO    [Toc]    [Back]

       Functions: atof(3), iswspace(3), localeconv(3),  scanf(3),
       setlocale(3), wcstol(3)

       Standards: standards(5)

[ Back ]
 Similar pages
Name OS Title
wcstod IRIX convert wide-character string to double-precision number
wcstold Tru64 Convert a wide-character string to a long double-precision value
mbsrtowcs FreeBSD convert a character string to a wide-character string (restartable)
wcsrtombs FreeBSD convert a wide-character string to a character string (restartable)
wcstof FreeBSD convert string to float, double or long double
wcstold FreeBSD convert string to float, double or long double
wcstod FreeBSD convert string to float, double or long double
mbsnrtowcs Linux convert a multibyte string to a wide character string
mbsrtowcs Linux convert a multibyte string to a wide character string
mbstowcs Linux convert a multibyte string to a wide character string
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service