mmeemmsseett() -- String Function (libc)

Fill an area with a character
#iinncclluuddee <ssttrriinngg.hh>
cchhaarr *mmeemmsseett(_b_u_f_f_e_r, _c_h_a_r_a_c_t_e_r, _n)
cchhaarr *_b_u_f_f_e_r; iinntt _c_h_a_r_a_c_t_e_r; uunnssiiggnneedd iinntt _n;

mmeemmsseett() fills  the first  _n bytes  of the area  pointed to by  _b_u_f_f_e_r with
copies of _c_h_a_r_a_c_t_e_r. It casts  _c_h_a_r_a_c_t_e_r to an uunnssiiggnneedd cchhaarr before filling
_b_u_f_f_e_r with copies of it.

mmeemmsseett() returns the pointer _b_u_f_f_e_r.

_E_x_a_m_p_l_e
The following example fills an area with `X', and prints the result.

#include <stdio.h>
#include <string.h>
#define BUFSIZ 20

main()
{
    char buffer[BUFSIZ];

    /* fill buffer with 'X' */
    memset(buffer, 'X', BUFSIZ);

    /* append null to end of buffer */
    buffer[BUFSIZ-1] = '\0';

    /* print the result */
    printf("%s\n", buffer);
    return(EXIT_SUCCESS);
}

_S_e_e _A_l_s_o
lliibbcc, ssttrriinngg.hh
ANSI Standard, section 7.11.6.1
