Sets the specified number of characters in a string to a character.
#include <string.h> char *strnset(char *string, int c, size_t count); char *_strnset(char *string, int c, size_t count); errno_t _strnset_s(char *string, size_t size, int c, size_t count); #include <wchar.h> errno_t _wcsnset_s(wchar_t *string, size_t size, int c, size_t count);
string
size
c
count
If count
is greater than the length of string
, the length of string
is used in place of count
. _strnset is an alternate name for strnset.
The _strnset_s function defines the length of the string using the size parameter.
_wcsnset_s is a wide-character version of _strnset_s.
strnset, _strnset: A pointer to the altered string.
_strnset_s, _wcsnset_s: Zero if successful, otherwise an error code. These functions perform parameter checking.
If string is not a valid null-terminated string or the size argument is less than or equal to 0, then these functions return an error code and set errno to that error code. The default error code is EINVAL if a more specific value does not apply.
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 INtime 6.0 for wide-character and secture versions |
intime/rt/include/string.h intime/rt/include/wchar.h |
string.h wchar.h |
clib.lib |