by needlepont · 8y ago · 0 comments
Really, stop using C. To quote Hayao Miyazaki, C was a mistake.
#define BUFSIZE 100
char buf[BUFSIZE+1]
buf[BUFSIZE]=0 // for global var, it is already zeroed, right?
Then one can call strncpy(buf, BUFSIZE, ...) without worrying about null-termination.