strncpy
T. William Wells
bill at twwells.com
Mon Jan 8 01:57:19 AEST 1990
In article <KURO.90Jan6014431 at vodka.Sun.Com> kuro at Corp.Sun.Com writes:
: I have no opinion about philosophical correctness of the current behavior of
: strncpy() but always do:
: strncpy(to, from, n);
: to[n]=0;
: This ensures the copied string is always null-terminated, if this is what you
: mean by "safe".
Maybe you meant "to[n - 1]=0;"?
If the size of to is n, to[n] = 0 is illegal.
---
Bill { uunet | novavax | ankh | sunvice } !twwells!bill
bill at twwells.com
More information about the Comp.lang.c
mailing list