wcstod() function in C/C++ Last Updated : 17 Sep, 2018 Comments Improve Suggest changes Like Article Like Report The wcstod() function converts the wide string as a double. This function interprets the contents of a wide string as a floating point number. If endString is not a null pointer, the function also sets the value of endString to point to the first character after the number. Syntax: double wcstod( const wchar_t* str, wchar_t** str_end ) Parameters: The function accepts two mandatory parameters which are described below: string: specifies the string which begins with the representation of a floating-point number endString: specifies the pointer to a wide character Return value: The function returns two value as below: On success, the function returns the converted floating point number as a value of type double. If no valid conversion could be performed, it returns 0.0 . If the correct value is out of the range of representable values for the type, a positive or negative HUGE_VAL is returned, and errno is set to ERANGE. If the correct value would cause underflow, the function returns a value whose magnitude is no greater than the smallest normalized positive number (some library implementations may also set errno to ERANGE in this case). Below programs illustrate the above function: Program 1 : CPP // C++ program to illustrate // wcstod() function #include <bits/stdc++.h> using namespace std; int main() { // initialize the wide string // beginning with the floating point number wchar_t string[] = L"95.6Geek"; // Pointer to a pointer to a wide character wchar_t* endString; // Convert wide string to double double value = wcstod(string, &endString); // print the string, starting double value // and its endstring wcout << L"String -> " << string << "\n"; wcout << L"Double value -> " << value << "\n"; wcout << L"End String is : " << endString << "\n"; return 0; } Output: String -> 95.6Geek Double value -> 95.6 End String is : Geek Program 2 : CPP // C++ program to illustrate // wcstod() function // with no endString characters #include <bits/stdc++.h> using namespace std; int main() { // initialize the wide string // beginning with the floating point number wchar_t string[] = L"10.6464"; // Pointer to a pointer to a wide character wchar_t* endString; // Convert wide string to double double value = wcstod(string, &endString); // print the string, starting double value // and its endstring wcout << L"String -> " << string << "\n"; wcout << L"Double value -> " << value << "\n"; wcout << L"End String is : " << endString << "\n"; return 0; } Output: String -> 10.6464 Double value -> 10.6464 End String is : Program 3 : CPP // C++ program to illustrate // wcstod() function // with whitespace present at the beginning #include <bits/stdc++.h> using namespace std; int main() { // initialize the wide string // beginning with the floating point number wchar_t string[] = L" 99.999Geek"; // Pointer to a pointer to a wide character wchar_t* endString; // Convert wide string to double double value = wcstod(string, &endString); // print the string, starting double value // and its endstring wcout << L"String -> " << string << "\n"; wcout << L"Double value -> " << value << "\n"; wcout << L"End String is : " << endString << "\n"; return 0; } Output: String -> 99.999Geek Double value -> 99.999 End String is : Geek Comment More infoAdvertise with us Next Article wcstod() function in C/C++ A AmanSrivastava1 Follow Improve Article Tags : Misc C Language C++ CPP-Functions C-Library +1 More Practice Tags : CPPMisc Similar Reads wcstol() function in C/C++ The wcstol() function in C/C++ converts the given wide string to a long integer. This function sets a pointer to point to the first character after the last valid character of the wide string if there is any, otherwise, the pointer is set to null. This function ignores all the leading whitespace cha 3 min read wcstoul() function in C/C++ The wcstoul() function in C/C++ converts a wide string to an unsigned long integer of the specified base. It sets a pointer to point to the first character after the last valid character of the wide string if there is any, otherwise, the pointer is set to null. It ignores all the leading whitespace 4 min read wcstoll() function in C/C++ The wcstoll() function in C/C++ converts a wide-character string to a long long integer. It sets the pointer to point the first character after the last character. Syntax : long long wcstoll( const wchar_t* str, wchar_t** str_end, int base ) Parameter: The function accepts three mandatory parameters 3 min read wcsncat() function in C/C++ The wcsncat() function appends the characters of the source to the destination, including a terminating null wide character. If the length of the string in source is less than num. Then only the content up to the terminating null wide character is copied. Syntax: wchar_t* wcsncat (wchar_t* destinati 2 min read wcrtomb() function in C/C++ The wcrtomb() function in C/C++ converts a wide character to its narrow multibyte representation. The wide character wc is translated to its multibyte equivalent and stored in the array pointed by s. The function returns the length in bytes of the equivalent multibyte sequence pointed by s. Syntax : 3 min read wcsrtombs() function in C/C++ The wcsrtombs() function converts wide character to multibyte string. This function converts the wide character string represented by *src to corresponding multibyte character string and is stored in the character array pointed to by dest if dest is not null. A maximum of len characters are written 2 min read wctob() function in C++ wctob() function in C++ helps to convert a wide character wc into a single byte, if its if its multibyte character equivalent in the initial shift state is a single byte. Since, the function uses single byte encoding, hence is used for characters from ASCII character set . Syntax: int wctob (wint_t 2 min read std::function in C++ The std::function() in C++ is a function wrapper class which can store and call any function or a callable object. In this article, we will learn about std::function in C++ and how to use it in different cases.Table of ContentWhat is std::function in C++?Example of std::functionMember Functions of s 5 min read wctype() function in C/C++ The wctype() is a built-in function in C/C++ which returns a value of type wctype_t that is used for classifying a wide character. It is defined within the cwctype header file of C++. The following are the possible type wctype_t: Value of str Equivalent function space iswspace upper iswupper xdigit 2 min read wcsncmp() function in C/C++ The wcsncmp() function in C/C++ compare characters of two wide strings. The comparison is done lexicographically. This function takes three arguments lhs, rhs and count. It compares the contents of lhs and rhs lexicographically upto a maximum of count wide characters. Note: The behaviour of wcsncmp( 3 min read Like