strncpy question

kevin.laux rkl at cbnewsh.ATT.COM
Fri May 12 01:58:06 AEST 1989


In article <630 at babbage.acc.virginia.edu>, pts at watt.acc.Virginia.EDU (Paul T. Shannon) writes:
} I have a question on the strncpy library function. (The same question applies to
} strcpy as well.) This program fragment seems to be the recommended usage:
} 
	[deleted fragment]
}
} Why is this function written so that the pointer to the destination string is 
} both
}        1. passed as  an argument to the function, and
}        2. returned by the function?
} 

	The return of the destination pointer allows for the function to be
passed as an argument to other functions, as in:

	printf ("<format...> %s\n", <args>, strncpy (dest, src, count));

--rkl



More information about the Comp.lang.c mailing list