GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::to_wstring(3) C++ Standard Libary std::to_wstring(3)

std::to_wstring - std::to_wstring


Defined in header <string>
std::wstring to_wstring( int value ); (1) (since C++11)
std::wstring to_wstring( long value ); (2) (since C++11)
std::wstring to_wstring( long long value ); (3) (since C++11)
std::wstring to_wstring( unsigned value ); (4) (since C++11)
std::wstring to_wstring( unsigned long value ); (5) (since C++11)
std::wstring to_wstring( unsigned long long value ); (6) (since C++11)
std::wstring to_wstring( float value ); (7) (since C++11)
std::wstring to_wstring( double value ); (8) (since C++11)
std::wstring to_wstring( long double value ); (9) (since C++11)


Converts a numeric value to std::wstring.


1) Converts a signed decimal integer to a wide string with the same content as what
std::swprintf(buf, sz, L"%d", value) would produce for sufficiently large buf.
2) Converts a signed decimal integer to a wide string with the same content as what
std::swprintf(buf, sz, L"%ld", value) would produce for sufficiently large buf.
3) Converts a signed decimal integer to a wide string with the same content as what
std::swprintf(buf, sz, L"%lld", value) would produce for sufficiently large buf.
4) Converts an unsigned decimal integer to a wide string with the same content as
what
std::swprintf(buf, sz, L"%u", value) would produce for sufficiently large buf.
5) Converts an unsigned decimal integer to a wide string with the same content as
what
std::swprintf(buf, sz, L"%lu", value) would produce for sufficiently large buf.
6) Converts an unsigned decimal integer to a wide string with the same content as
what
std::swprintf(buf, sz, L"%llu", value) would produce for sufficiently large buf.
7,8) Converts a floating point value to a wide string with the same content as what
std::swprintf(buf, sz, L"%f", value) would produce for sufficiently large buf.
9) Converts a floating point value to a wide string with the same content as what
std::swprintf(buf, sz, L"%Lf", value) would produce for sufficiently large buf.


value - a numeric value to convert


a wide string holding the converted value


May throw std::bad_alloc from the std::wstring constructor.

// Run this code


#include <iostream>
#include <string>


int main()
{
for (const double f : { 23.43, 1e-9, 1e40, 1e-40, 123456789. }) {
std::wcout << "std::wcout: " << f << '\n'
<< "to_wstring: " << std::to_wstring(f) << "\n\n";
}
}


std::wcout: 23.43
to_wstring: 23.430000


std::wcout: 1e-09
to_wstring: 0.000000


std::wcout: 1e+40
to_wstring: 10000000000000000303786028427003666890752.000000


std::wcout: 1e-40
to_wstring: 0.000000


std::wcout: 1.23457e+08
to_wstring: 123456789.000000


to_string converts an integral or floating point value to string
(C++11) (function)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.