CompuServe Thread

#AVL Tree

4 messages in this thread
#6362From: Jeff BrentonSep 6, 1986 7:11 PM
memcpy() is a generic routine, usually implement in assembler for the added speed possible. it CAN be done in C, but that would not take advantage of built-in instructions on particular machines, such as the LDIR of the Z80 and MOVS on the 8086. char *memcpy(dest,src,count) char *dest,*src; int count; /* copy count characters [or bytes] from src to dest */ for now, i'll leave the coding up to you, but your compiler SHOULD have an equivalent function – it has been in Unix libraries since before version 7! it _may_ be named move(), or something similar, however.
#6377From: Al ShrockSep 7, 1986 2:25 AM
The strncpy() function supplied in the libraries of most compilers performs the same job. Okay, its going to be written in C instead of assembly, but its a solution to his problem.
#6378From: Gerald EdgarSep 7, 1986 6:58 AM
Doesn't strncpy() quit when it reaches a zero byte?
#6379From: Fred BuckSep 7, 1986 9:00 AM
Yep. It also (in most implementations) zeros out the destination string from that point to 'n' or the end of the destination, whichever comes first. Not exactly a premier block-copy routine except for data guaranteed to contain no nulls.