On Mon, Jun 28, 2010 at 6:44 PM, Gregory Ewing <greg.ew...@canterbury.ac.nz> wrote: > Carl Banks wrote: > >> Indeed, strncpy does not copy that final NUL if it's at or beyond the >> nth element. Probably the most mind-bogglingly stupid thing about the >> standard C library, which has lots of mind-boggling stupidity. > > I don't think it was as stupid as that back when C was > designed
Actually, strncpy had a very specific use case when it was introduced (dealing with limited-size entries in very old unix filesystem). It should never be used for C string handling, and I don't think it is fair to say it is stupid: it does exactly what it was designed for. It just happens that most people don't know what it was designed for. David -- http://mail.python.org/mailman/listinfo/python-list