FairCom Corporation


F.27 cpybuf


Copy one buffer area to another regardless of any null characters.

Short Name

cpybuf

TYPE

Utility function

DECLARATION

void cpybuf(pTEXT destination, pTEXT source, UINT length)

DESCRIPTION

cpybuf copies length bytes from source to destination.

It does not stop when it sees a null character. You can copy strings or structures with this.

We strongly suggest using cpybuf instead of strcpy, for the following reasons:

EXAMPLE

COUNT keyno;
TEXT target[24],idxval[23];
LONG recbyt;
scanf("%23s",target);
recbyt = GetGTEKey(keyno,target,idxval);
while (recbyt) {
printf("\nIndex entry = %23s ", idxval);
printf("\nRecord # = %ld, recbyt);
cpybuf(target,idxval,23);
recbyt = GetGTKey(keyno,target,idxval);
}

LIMITATIONS

cpybuf does not check to see if the buffer at destination is large enough to hold the data being moved.

SEE ALSO

c-tree Plus also includes cpybig, which provides the same functionality as cpybuf, but works for very large buffers even on machines with segmented memory models. The length parameter is declared as VRLEN instead of UINT, which provides for larger buffers.


FairCom Corporation
www.faircom.com