The stcopy() function

The stcopy() function copies a null-terminated string from one location in memory to another location.

Syntax

void stcopy(from, to)
   char *from, *to;
from
A pointer to the null-terminated string that you want stcopy() to copy.
to
A pointer to a location in memory where stcopy() copies the string.

Example

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

   This program displays the result of copying a string using stcopy().
*/

#include <stdio.h>

main()
{
    static char string[] = "abcdefghijklmnopqrstuvwxyz";

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

    printf("Initial string:\n  [%s]\n", string);         /* display dest */
    stcopy("John Doe", &string[15]);                     /* copy */
    printf("After copy of 'John Doe' to position 15:\n  [%s]\n", 
        string);      

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

Output

STCOPY Sample ESQL Program running.

Initial string:
  [abcdefghijklmnopqrstuvwxyz]
After copy of 'John Doe' to position 15:
  [abcdefghijklmnoJohn Doe]

STCOPY Sample Program over.