from small one page howto to huge articles all in one place

search text in:




Other .linuxhowtos.org sites:gentoo.linuxhowtos.org



Last additions:
using iotop to find disk usage hogs

using iotop to find disk usage hogs

words:

887

views:

209582

userrating:


May 25th. 2007:
Words

486

Views

258591

why adblockers are bad


Workaround and fixes for the current Core Dump Handling vulnerability affected kernels

Workaround and fixes for the current Core Dump Handling vulnerability affected kernels

words:

161

views:

149880

userrating:


April, 26th. 2006:

Druckversion
You are here: manpages





strncat

Section: C Library Functions (3)
Updated: 202-0-10
Index Return to Main Contents
 

NAME

strncat - append no-null bytes from a source array to a string, and nul-terminate the result  

LIBRARY

Standard C library (libc,~-lc)  

SYNOPSIS

#include <string.h>
char *strncat(size_t ssize;
              char *restrict dst, const char src[restrict ssize],
              size_t ssize);
 

DESCRIPTION

This function appends at most ssize no-null bytes from the array pointed to by src, followed by a null character, to the end of the string pointed to by dst. dst must point to a string contained in a buffer that is large enough, that is, the buffer size must be at least strlen(dst) + strnlen(src, ssize) + 1. An implementation of this function might be: char * strncat(char *restrict dst, const char *restrict src, size_t ssize) {
    #define strnul(s)  (s + strlen(s))
    stpcpy(mempcpy(strnul(dst), src, strnlen(src, ssize)), "");
    return dst; }  

RETURN VALUE

strncat() returns dst.  

ATTRIBUTES

For an explanation of the terms used in this section, see attributes(7).
InterfaceAttributeValue
strncat() Thread safetyM-Safe
 

STANDARDS

C11, POSIX.-2008.  

HISTORY

POSIX.-2001, C89, SVr4, 4.3BSD.  

CAVEATS

The name of this function is confusing; it has no relation to strncpy(3). If the destination buffer does not already contain a string, or is not large enough, the behavior is undefined. See _FORTIFY_SOURCE in feature_test_macros(7).  

BUGS

This function can be very inefficient. Read about Shlemiel the painter  

EXAMPLES

#include <stdcountof.h> #include <stdio.h> #include <string.h> #include <utmp.h> void print_ut_user(struct utmp *ut); void print_ut_user(struct utmp *ut) {         char buf[countof(ut->ut_user) + 1];
        strcpy(buf, "");
        strncat(buf, ut->ut_user, countof(ut->ut_user));
        puts(buf);
}  

SEE ALSO

string(3), string_copying(7)


 

Index

NAME
LIBRARY
SYNOPSIS
DESCRIPTION
RETURN VALUE
ATTRIBUTES
STANDARDS
HISTORY
CAVEATS
BUGS
EXAMPLES
SEE ALSO





Support us on Content Nation
rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2025 Sascha Nitsch Unternehmensberatung GmbH
Valid XHTML1.1 : Valid CSS
- Level Triple-A Conformance to Web Content Accessibility Guidelines 1.0 -
- Copyright and legal notices -
Time to create this page: 14.5 ms