C library function mbtowc()




C library function mbtowc()

#include <stdio.h>
#include <stdlib.h>

int main()
{
	char pmb[] = "Welcome to Tutorialaaroot.com";
	wchar_t pwc[100];
	int len, ret_val;

	/* resets internal conversion state */
	mbtowc (NULL, NULL, 0);
	len = strlen(pmb);
	ret_val = mbtowc(pwc, pmb, strlen(pmb));

	cout << "Return Value = " << ret_val << endl;
	wcout << "Wide character string: " << pwc;

	return(0);
}

Output

Return Value = 1
Wide character string: W@