|
|||||||||||
|
Re: safe strcpy()?
From: Ben Pfaff <blp(at)cs.stanford.edu>
Date: Wed Jan 29 2003 - 18:40:16 EST "Michael Howard" <mikehow@microsoft.com> writes: > The point I'm making is people seem to think they can write crap code,
The usual reason cited not to use strncpy() is that it doesn't necessarily null-terminate its output buffer. But there's at least one other reason: using strncpy() into a large buffer can be very inefficient. strncpy() always writes to every byte in the destination buffer, which can waste a lot of time if the destination buffer is much longer than the source string. -- "If a person keeps faithfully busy each hour of the working day, he can count on waking up some morning to find himself one of the competent ones of his generation." --William JamesReceived on Wed Jan 29 18:56:32 2003 This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 14:02:46 EDT |
||||||||||
|
|||||||||||