Header file:
wctype.h
Synopsis:
wint_t towctrans(wint input, wctrans_t desc)
Description:
Translates the given input(input) based on the transliteration descriptor desc. If the given input is EOF, WEOF is returned.
Sample program for towctrans in C:
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
int main() {
wctrans_t a;
wint_t wide_char;
char input;
a = wctrans("digit");
printf("Enter your input:");
input = getchar();
/* mbtowc -Converts character to wide character format */
wide_char = btowc(input);
printf("Return value: %d\n", towctrans(wide_char, a));
printf("Sizeof(wctrans): %d\n", sizeof(wctrans_t));
return 0;
}
#include <wchar.h>
#include <wctype.h>
int main() {
wctrans_t a;
wint_t wide_char;
char input;
a = wctrans("digit");
printf("Enter your input:");
input = getchar();
/* mbtowc -Converts character to wide character format */
wide_char = btowc(input);
printf("Return value: %d\n", towctrans(wide_char, a));
printf("Sizeof(wctrans): %d\n", sizeof(wctrans_t));
return 0;
}
Output:
Enter your input:1
Return value: 49
Sizeof(wctrans): 4
Return value: 49
Sizeof(wctrans): 4
No comments:
Post a Comment