Name

wmemmove

Synopsis

Copies the contents of a block of wide characters

#include <wchar.h>
wchar_t *wmemmove( wchar_t *dest, const wchar_t *src, size_t n );

The wmemmove() function copies n successive wide characters beginning at the address in src to the location beginning at the address in dest. The return value is the same as the first argument, dest. If the source and destination blocks overlap, copying takes place as if through a temporary buffer; after the function call, each original value from the src block appears in dest.

Example

#define LINESIZE   2048         // Sizes as numbers of wchar_t elements.
FILE *fp_input, *fp_tmp;
w_char inputblock[LINESIZE*128], *writeptr;

/* ... Input some lines to the input block ... */

/* Dump most of the block to a temporary file ... */
fp_tmp = tmpfile();
fwrite( inputblock, sizeof(wchar_t), LINESIZE*127, fp_tmp );

/* ... push the rest of the block to the front ... */wmemmove( inputblock, inputblock + LINESIZE*127, LINESIZE );

/* ... and continue input: */
writeptr -= LINESIZE*127;
/* ... */

Get C in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.