RAD Studio |  |

strset, _mbsset, _wcsset

Header File

string.h, mbstring.h

Category

Memory and String Manipulation Routines, Inline Routines

Prototype

char *strset(char *s, int ch);

wchar_t *_wcsset(wchar_t *s, wchar_t ch);

unsigned char *_mbsset(unsigned char *s, unsigned int ch);

Description

Sets all characters in a string to a given character.

strset sets all characters in the string s to the character ch. It quits when the terminating null character is found.

Return Value

strset returns s.

Example

Copy Code

    #include <stdio.h>
    #include <string.h>
    int main(void)
    {
       char string[10] = "123456789";
       char symbol = 'c';
       printf("Before strset(): %s\n", string);
       strset(string, symbol);
       printf("After strset():  %s\n", string);
       return 0;
    }

Portability

| POSIX | Win32 | ANSI C | ANSI C++
strset |  | + |  |
_mbsset |  | + |  |
_wcsset |  | + |  |

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!