/************************************************************************ * * * Copy a NUL-terminated String * * * ************************************************************************/ /* Author: John Zaitseff Date: 9th September, 2002 Version: 1.3 This program copies a NUL-terminated string from one location to another. The main feature of this program is the use of a separate assembly language module, "copy.s", for the actual copy-string function: it is an example of mixing C and assembly-language programs. Please make sure that you read the source code to "copy.s"! */ #include extern void strcopy(char *dest, const char *src); /* Copy the string "src" to the destination buffer "dest"; in "copy.s" */ int main (void) { const char *srcstr = "First (source) string"; char dststr[] = "Second (destination) string"; printf("Before copying:\n"); printf("srcstr = \"%s\"\n", srcstr); printf("dststr = \"%s\"\n\n", dststr); strcopy(dststr, srcstr); printf("After copying:\n"); printf("srcstr = \"%s\"\n", srcstr); printf("dststr = \"%s\"\n\n", dststr); return 0; }