A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.tutorialspoint.com/cpp_standard_library/cpp_locale_encoding.htm below:

C++ Locale Library - encoding

C++ Locale Library - encoding Description

It returns the width of an internal character in terms of external characters, if this is a fixed value. Otherwise, if this is a variable value, the function returns 0.

Declaration

Following is the declaration for std::ctype::encoding.

C++98
	
int encoding() const throw();
C++11
int encoding() const throw();
Parameters

none

Return Value

It returns the width of an internal character in terms of external characters, if this is a fixed value.

Exceptions

No-throw guarantee − never throws exceptions.

Data races

The facet object is accessed.

Example

In below example explains about std::ctype::encoding.

#include <iostream>
#include <locale>

int main () {
   std::locale loc;

   const std::codecvt<wchar_t,char,mbstate_t>& myfacet =
      std::use_facet<std::codecvt<wchar_t,char,mbstate_t> >(loc);

   std::cout << "Characteristics of codecvt<wchar_t,char,mbstate_t>:\n";
   std::cout << "Encoding: " << myfacet.encoding() << '\n';
   std::cout << "Always noconv: " << myfacet.always_noconv() << '\n';
   std::cout << "Max length: " << myfacet.max_length() << '\n';
   return 0;
}

Let us compile and run the above program, this will produce the following result −

Characteristics of codecvt<wchar_t,char,mbstate_t>:
Encoding: 1
Always noconv: 0
Max length: 1

locale.htm


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4