View Full Version : C programming: Terminating a String

05-23-2007, 10:27 AM
I feel such a fool.
Until a few years ago I was a C Instructor.
Now my C has become very rusty.

If I strcpy part of a string into an empty buffer,
how do I place a '\0' at the end of my new string?

05-23-2007, 05:04 PM
strcpy should automatically terminate the new string.

If you give it a null terminated string, it will copy the null along with the rest of the string into the buffer.