Using localized settings for streams
The way writing or reading to and from streams is performed may depend on language and regional settings. Examples include writing and parsing numbers, time values, or monetary values, or comparing (collating) strings. The C++ input/output library provides a general purpose mechanism for handling internationalization features through locales and facets. In this recipe, you will learn how to use locales to control the behavior of input/output streams.
Getting ready
All the examples in this recipe are using the std::cout
predefined console stream object. However, the same applies to all input/output stream objects. Also, in this recipe examples, we will use the following objects and lambda function:
   auto now = std::chrono::system_clock::now();    auto stime = std::chrono::system_clock::to_time_t(now);    auto ltime = std::localtime(&stime);    std::vector<std::string> names {"John", "adele", "Øivind", "François", "Robert", "Åke"};...