C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
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 );
}
                                    -♦-