Run-Time Library Reference
Memset, WMemset
See Also
Buffer manipulation routines | _MEMCCPY | MEMCHR | MEMCMP | MEMCPY | _STRNSET | Run-Time Routines and .NET Framework Equivalents
Requirements
RoutineRequidHeaderCompaTibilityMemset
For Additional Compatibility Information, See Compatibility In The Introduction.
Libraries
All Versions of The C Run-Time Libraries.
Sets buffers to a specified character.
Void * MEMSET
Void * DEST,
INT C,
SIZE_T Count
);
WCHAR_T * WMEMSET
Wchar_t * dest,
Wchar_t C,
SIZE_T Count
);
Parameters
Destin
Pointer to Destination.
c
CHARACTER TO SET.
count
NUMBER OF CHARACTERS.
Return Value
The value of dest.
Remarks
Sets the first count chars of dest to the character c.
Security Note Make Sure That The Destination Buffer Is The Same Size Or Larger Than The Source Buffer. For more information, see
Avoiding Buffer Overruns
.
Requirements
RoutineRequidHeaderCompaTibilityMemset
For Additional Compatibility Information, See Compatibility In The Introduction.
Libraries
All Versions of The C Run-Time Libraries.
EXAMPLE
// CRT_MEMSET.C
/ * This Program Uses Memset To
* Set The First Four Chars of Buffer to "*".
* /
#include
#include
Int main (void)
{
Char buffer [] = "this is a test of the memset function";
Printf ("Before:% S / N", BUFFER;
MEMSET (Buffer, '*', 4);
Printf ("After:% S / N", Buffer;
OUTPUT
BEFORE: this is a test of the memset function
After: **** Is A Test of the MEMSET FUNCTION
See Also
Buffer manipulation routines | _MEMCCPY | MEMCHR | MEMCMP | MEMCPY | _STRNSET | Run-Time Routines and .NET Framework Equivalents
Send Feedback on this Topic to Microsoft
© Microsoft Corporation. All Rights Reserved.