Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- #include <string.h>
- #include <locale.h>
- #define BUF 256
- void remove_chars(wchar_t *, wchar_t *);
- int main() {
- wchar_t buffer[BUF], suite[BUF];
- _wsetlocale(LC_CTYPE, L"Russian_Russia.866");
- wprintf(L"Ввести строку: ");
- _getws_s(buffer, BUF);
- wprintf(L"Введите символы, которые следует удалить: ");
- _getws_s(suite, BUF);
- remove_chars(buffer, suite);
- wprintf_s(L"%s\n", buffer);
- _getwch();
- return 0;
- }
- void remove_chars(wchar_t * _string, wchar_t * _suite_chars) {
- size_t next;
- wchar_t * pdest = NULL, * beg, * last = _string + wcsnlen(_string, BUF) - 1;
- for (next = 0; _suite_chars[next] != 0; next++) {
- do {
- pdest = wcschr(_string, _suite_chars[next]);
- if (pdest) {
- beg = pdest;
- for (++beg; beg <= last; beg++) *(beg - 1) = *beg;
- *(beg - 1) = 0;
- --last;
- }
- } while (pdest);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement