#include <stdio.h>
#include <wchar.h>
#include <locale.h>
int main() {
setlocale(LC_CTYPE, "");
wchar_t str[] = L"This is a test string";
wprintf(L"Original string: %ls\n", str);
wchar_t *ptr = wcschr(str, L's');
*ptr = L'S';
wprintf(L"String after replacing 's' with 'S': %ls\n", str);
return 0;
}
#include <stdio.h>
#include <wchar.h>
#include <regex.h>
int main() {
wchar_t *pattern = L"Hello";
wchar_t *string = L"Hello world";
int result = regexec(pattern, string, 0, NULL, 0);
if (result == 0) {
wprintf(L"Match found.\n");
} else {
wprintf(L"Match not found.\n");
}
return 0;
}
#include <stdio.h>
#include <wchar.h>
int main() {
wchar_t name[] = L"John Doe";
int age = 30;
wprintf(L"Name: %ls, Age: %d\n", name, age);
return 0;
}
#include <stdio.h>
#include <wchar.h>
int main() {
double value = 123.456;
wprintf(L"Value: %.2lf\n", value);
return 0;
}
#include <stdio.h>
#include <wchar.h>
int main() {
FILE *file = fopen("test.txt", "w");
fwprintf(file, L"This is a wide string written to a file.\n");
fclose(file);
return 0;
}