diff options
Diffstat (limited to 'libc/manual/examples/strncat.c')
-rw-r--r-- | libc/manual/examples/strncat.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libc/manual/examples/strncat.c b/libc/manual/examples/strncat.c new file mode 100644 index 000000000..f865167f4 --- /dev/null +++ b/libc/manual/examples/strncat.c @@ -0,0 +1,14 @@ +#include <string.h> +#include <stdio.h> + +#define SIZE 10 + +static char buffer[SIZE]; + +main () +{ + strncpy (buffer, "hello", SIZE); + puts (buffer); + strncat (buffer, ", world", SIZE - strlen (buffer) - 1); + puts (buffer); +} |