strncpy

Buster Irby rli at buster.irby.com
Thu Jan 25 05:29:27 AEST 1990


brnstnd at stealth.acf.nyu.edu writes:

>Since I do, in fact, always null-terminate the string myself, I'd prefer
>that strncpy do the job for me.

You have obviously never worked with any vendor supplied software
which used non null-terminated buffers.  For example, when you
access a string data field under Unify, there is no null
termination at the end of the field, because the string fields
are fixed length.  It is not necessary to terminate fixed length
items with any kind of special marker.  Special markers, such as
the null character, are only useful when dealing with variable
length data.  Furthermore, in any database, I would consider it
very inefficient to store null terminators.

-- 
Buster Irby  buster!rli



More information about the Comp.lang.c mailing list