4 ms·
”C programmers should use the newer strncpy()” Newer? I thought strncpy dates back to the time Unix filenames were 14 characters, max, adding padding zeroes wh
by Someone 8y ago
”C programmers should use the newer strncpy()”
Newer? I thought strncpy dates back to the time Unix filenames were 14 characters, max, adding padding zeroes when needed in some fixed-length kernel structures.
That’s also the reason strncpy always writes len bytes; not keeping garbage content in those 14-byte buffers allows the system to use memcmp to compare file names.