C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
SETSTR.C
                                             Up Contents Index Back
─────Run-Time Library───────────────────────────────────────────────────────
 
/* SETSTR.C illustrates string and memory set functions including:
 *     memset           _strnset         _strset
 */
 
#include <memory.h>
#include <string.h>
#include <stdio.h>
 
char string[60] = "The quick brown dog jumps over the lazy fox ";
/*                          1         2         3         4         5 *
 *                 12345678901234567890123456789012345678901234567890 */
void main()
{
    printf( "Function:\tmemset with fill character '█'\n" );
    printf( "Destination:\t%s\n", string );
    memset( string + 10, '█', 5 );
    printf( "Result:\t\t%s\n\n", string );
 
    printf( "Function:\t_strnset with fill character '█'\n" );
    printf( "Destination:\t%s\n", string );
    _strnset( string + 15, '█', 5 );
    printf( "Result:\t\t%s\n\n", string );
 
    printf( "Function:\t_strset with fill character '█'\n" );
    printf( "Destination:\t%s\n", string );
    _strset( string + 20, '█' );
    printf( "Result:\t\t%s\n\n", string );
}
                                    -♦-