December 2005
Beginner to intermediate
618 pages
20h 19m
English
wmemmove
Copies the contents of a block of wide characters
#include <wchar.h> wchar_t *wmemmove( wchar_t *dest, const wchar_t *src, size_tn);
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.
#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;
/* ... */Read now
Unlock full access