strset, _mbsset, _wcsset
Go Up to string.h Index
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
#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 |
+ |