aboutsummaryrefslogtreecommitdiff
path: root/manual/examples/strncat.c
diff options
context:
space:
mode:
Diffstat (limited to 'manual/examples/strncat.c')
-rw-r--r--manual/examples/strncat.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/manual/examples/strncat.c b/manual/examples/strncat.c
new file mode 100644
index 0000000..f865167
--- /dev/null
+++ b/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);
+}