La funzione btowc () in C ++ converte un carattere nel suo equivalente di caratteri wide.
La funzione btowc () è definita nel file di intestazione.
btowc () prototipo
wint_t btowc (int c);
La funzione btowc () accetta un carattere c a byte singolo come argomento e restituisce l'equivalente in caratteri wide.
Parametri btowc ()
- c: il carattere a byte singolo da convertire in caratteri larghi.
btowc () Restituisce il valore
La funzione btowc () restituisce la rappresentazione in caratteri estesi di c se c è un carattere a byte singolo valido. Se c è EOF, viene restituito WEOF.
Esempio: come funziona la funzione btowc ()?
#include #include #include using namespace std; int main() ( char str() = "Helloxf4xdf"; wchar_t wc; int count = 0; for (int i=0; i
When you run the program, the output will be:
5 out of 7 characters were successfully widened