The byfill() function

The byfill() function fills a specified area with one character.

Syntax

void byfill(to, length, ch)
   char *to;
   mint length;
   char ch;
to
A pointer to the first byte of the memory area that you want byfill() to fill.
length
The number of times that you want byfill() to repeat the character within the area.
ch
The character that you want byfill() to use to fill the area.
Important: Take care not to overwrite areas of memory next to the area that you want byfill() to fill.

Example

This sample program is in the byfill.ec file in the demo directory.
/*
   * byfill.ec *

   The following program shows the results of three byfill() operations on 
   an area that is initialized to x's.
*/

#include <stdio.h>

main()
{
    static char area[20] = "xxxxxxxxxxxxxxxxxxx";

    printf("BYFILL Sample ESQL Program running.\n\n");

    printf("String = %s\n", area);

    printf("\nFilling string with five 's' characters:\n");
    byfill(area, 5, 's');
    printf("Result = %s\n", area);

    printf("\nFilling string with two 's' characters starting at ");
    printf("position 16:\n");
    byfill(&area[16], 2, 's');
    printf("Result = %s\n", area);

    printf("Filling entire string with 'b' characters:\n");
    byfill(area, sizeof(area)-1, 'b');
    printf("Result = %s\n", area);

    printf("\nBYFILL Sample Program over.\n\n");
}

Output

BYFILL Sample ESQL Program running.

String = xxxxxxxxxxxxxxxxxxx

Filling string with five 's' characters:
Result = sssssxxxxxxxxxxxxxx

Filling string with two 's' characters starting at position 16:
Result = sssssxxxxxxxxxxxssx

Filling entire string with 'b' characters:
Result = bbbbbbbbbbbbbbbbbbb

BYFILL Sample Program over.