Ticket #1446: boost-alpha.c

File boost-alpha.c, 496 bytes (added by tomaz.solc@…, 15 years ago)

Example demonstrating POSIX API problem.

Line 
1#define UNICODE
2#include <boost/regex.h>
3
4#include <stdio.h>
5#include <wctype.h>
6#include <locale.h>
7
8int main() {
9 regex_t r;
10
11 setlocale(LC_ALL, "en_US.utf8");
12
13 regcomp(&r, L"^[[:alpha:]]$", REG_EXTENDED);
14
15 printf("%d\n", iswalpha(L'A'));
16 printf("%d\n\n", regexec(&r, L"A", 0, NULL, 0));
17
18 printf("%d\n", iswalpha(L'\x160'));
19 printf("%d\n\n", regexec(&r, L"\x160", 0, NULL, 0));
20
21 printf("%d\n", iswalpha(L'1'));
22 printf("%d\n", regexec(&r, L"1", 0, NULL, 0));
23
24 regfree(&r);
25
26 return 0;
27}