qc.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
────────────────────────────────────────────────────────────────────────────
 
/* 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:\tstrnset with fill character '█'\n" );
    printf( "Destination:\t%s\n", string );
    strnset( string + 15, '█', 5 );
    printf( "Result:\t\t%s\n\n", string );
 
    printf( "Function:\tstrset with fill character '█'\n" );
    printf( "Destination:\t%s\n", string );
    strset( string + 20, '█' );
    printf( "Result:\t\t%s\n\n", string );
}