Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!helios!stat!john From: john@stat.tamu.edu (John S. Price) Newsgroups: comp.lang.c Subject: Re: strncpy Summary: works exactly right, if you know what a string is Message-ID: <4129@helios.TAMU.EDU> Date: 24 Jan 90 01:35:55 GMT References: <11527@csli.Stanford.EDU> <000003Q@cdis-1.UUCP> <11616@csli.Stanford.EDU> <48314938.f69e@phobos.UUCP> <11864@csli.Stanford.EDU> <25BC3A32.3F5B@marob.masa.com> <11881@csli.Stanford.EDU> <11882@csli.Stanford.EDU> Sender: usenet@helios.TAMU.EDU Reply-To: john@stat.tamu.edu (John S. Price) Organization: Statistics Department, Texas A&M University Lines: 16 In article <11882@csli.Stanford.EDU> poser@csli.stanford.edu (Bill Poser) writes: >...[stuff deleted]... >So, what strncpy does is to COPY up to the null byte or N characters, >whichever comes first, and then null-pad out to the N character limit. This is exactly right. Strncpy copys exactly N characters from source to destination. If N > strlen(source) then strncpy cannot assume that the bytes after the NULL in source are part of the string. The manuals aren't ambiguous if you take into consideration the definition of a string. -------------------------------------------------------------------------- John Price | It infuriates me to be wrong john@stat.tamu.edu | when I know I'm right.... --------------------------------------------------------------------------