This is the mail archive of the
mailing list for the glibc project.
Copying and concatenating strings with str5 functions
- From: Eric Sanchis <eric dot sanchis at iut-rodez dot fr>
- To: libc-help at sourceware dot org
- Date: Sat, 1 Nov 2014 14:49:49 +0100
- Subject: Copying and concatenating strings with str5 functions
- Authentication-results: sourceware.org; auth=none
Today, string copy/concatenation remains a problem. I suggest an
alternative to strncpy/strncat (strn) and strlcpy/strlcat (strl)
Str5cpy/str5cat functions are:
- C89 compliant
- Safer and easier to use than strn/strl functions
- Transparent (no silent unwanted behaviour) and orthogonal (uniform behaviour).
They return a meaningful return value and produce auto-documented source code.
Please, take a look to the str5 functions and the companion document:
Using strcpy/strcat in simple cases and str5cpy/str5cat in tricky
situations could be a good compromise.
University of Toulouse Capitole (IUT de Rodez)