memcpyp -- Copy Characters (with Padding)

SYNOPSIS

 #include <lcstring.h>

 void *memcpyp(void *target, const void *source,
               size_t tsize, size_t ssize, int pad);
 

DESCRIPTION

memcpyp copies bytes from the source area to the target area, padding out to the target size (tsize) after ssize bytes are copied from source. The code generated by memcpyp uses the MCVL instruction to perform data movement.

RETURN VALUE

memcpyp returns a pointer to the target area.

IMPLEMENTATION

The compiler generates inline code for memcpyp unless memcpyp is undefined (by an #undef statement) to prevent this. The inline code may still call a library routine in special cases (for example, if the length is a variable whose value is larger than 16 megabytes).

The code generated for memcpyp usually uses the MVCL instruction to perform data movement. If more than 16 megabytes of data are to be moved, the library routine is called, which moves 16M-1 bytes at a time. (Thus, the effect on overlapping fields can depend on whether they are separated by as much as 16 megabytes.)

EXAMPLE

  #include <lcstring.h>
  #include <stdio.h>

  main()
  {
     char *a;
     char name[41], input[25];

     puts("Enter your name:");
     a = gets(input);

        /* Copy input to name; pad with '*' to 40 characters. */
     memcpyp(name, a, 40,strlen(a), '*');
     a[40]='0';
     printf("Name padded to 40 characters : %.40sn", name);
  }

 

RELATED FUNCTIONS

memcpy

SEE ALSO

String Utility Functions

Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.