memset, _wmemset

From RAD Studio
Jump to: navigation, search

Go Up to mem.h Index



Header File

mem.h, string.h

Category

Memory and String Manipulation Routines, Inline Routines

Prototype

void *memset(void *s, int c, size_t n);

void *_wmemset(void *s, int c, size_t n);

Description

Sets n bytes of a block of memory to byte c.

memset sets the first n bytes of the array s to the character c.

Return Value

memset returns s.

Example

#include <string.h>
#include <stdio.h>
#include <mem.h>
int main(void)
{
    char buffer[] = "Hello world\n";
    printf("Buffer before memset: %s\n", buffer);
    memset(buffer, '*', strlen(buffer) - 1);
    printf("Buffer after memset:  %s\n", buffer);
    return 0;
}
 

Portability

POSIX Win32 ANSI C ANSI C++

memset

+

+

+

+

_wmemset

+