std::mbsinit
De cppreference.com
![]() |
Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate.
La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
Definido en el archivo de encabezado <cwchar>
|
||
int mbsinit( const std::mbstate_t* ps); |
||
Si
ps
no es un puntero nulo, la función mbsinit
determina si el objeto puntiagudo para std::mbstate_t describe el estado inicial de conversión . Original:
If
ps
is not a null pointer, the mbsinit
function determines whether the pointed-to std::mbstate_t object describes the initial conversion state. The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Contenido |
[editar] Notas
Aunque un inicializarse en cero std::mbstate_t siempre representa el estado inicial de conversión, puede haber otros valores de std::mbstate_t que también representan el estado inicial de conversión .
Original:
Although a zero-initialized std::mbstate_t always represents the initial conversion state, there may be other values of std::mbstate_t that also represent the initial conversion state.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[editar] Parámetros
ps | - | pointer to the std::mbstate_t object to examine |
[editar] Valor de retorno
0
ps
si no es un puntero nulo y no reporesent el estado de conversión inicial, valor distinto de cero de otra manera .Original:
0 if
ps
is not a null pointer and does not reporesent the initial conversion state, nonzero value otherwise.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[editar] Ejemplo
Ejecuta este código
#include <clocale> #include <string> #include <iostream> #include <cwchar> int main() { // allow mbrlen() to work with UTF-8 multibyte encoding std::setlocale(LC_ALL, "en_US.utf8"); // UTF-8 narrow multibyte encoding std::string str = u8"水"; // or u8"\u6c34" or "\xe6\xb0\xb4" std::mbstate_t mb = std::mbstate_t(); (void)std::mbrlen(&str[0], 1, &mb); if (!std::mbsinit(&mb)) { std::cout << "After processing the first 1 byte of " << str << " the conversion state is not initial\n"; } (void)std::mbrlen(&str[1], str.size()-1, &mb); if (std::mbsinit(&mb)) { std::cout << "After processing the remaining 2 bytes of " << str << ", the conversion state is initial conversion state\n"; } }
Salida:
After processing the first 1 byte of 水 the conversion state is not initial After processing the remaining 2 bytes of 水, the conversion state is initial conversion state
[editar] Ver también
conversión de la información de estado necesaria para repetir las cadenas de caracteres multibyte Original: conversion state information necessary to iterate multibyte character strings The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (clase) | |
Documentación de C para mbsinit
|