Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
_strset, _wcsset, _mbsset
Set characters of a string to a character.
char*_strset(char*string,intc**);**
wchar_t*_wcsset(wchar_t*string,wchar_tc**);**
unsignedchar*_mbsset(unsignedchar*string,unsignedintc**);**
For additional compatibility information, see Compatibility in the Introduction.
Libraries
Return Value
Each of these functions returns a pointer to the altered string. No return value is reserved to indicate an error.
Parameters
string
Null-terminated string to be set
c
Character setting
Remarks
The _strset function sets all the characters of string to c (converted to char), except the terminating null character. _wcsset and _mbsset are wide-character and multibyte-character versions of _strset. The data types of the arguments and return values vary accordingly. These three functions behave identically otherwise.
Generic-Text Routine Mappings
Example
/* STRSET.C */
#include <string.h>
#include <stdio.h>
void main( void )
{
char string[] = "Fill the string with something";
printf( "Before: %s\n", string );
_strset( string, '*' );
printf( "After: %s\n", string );
}
Output
Before: Fill the string with something
After: ******************************
See Also _mbsnbset, memset, strcat, strcmp, strcpy, _strnset