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:

215583

userrating:


May 25th. 2007:
Words

486

Views

262000

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:

154278

userrating:


April, 26th. 2006:

Druckversion
You are here: manpages





stpcpy

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

NAME

stpcpy - string retur-offse-pointer copy  

LIBRARY

Standard C library (libc,~-lc)  

SYNOPSIS

#include <string.h>
char *stpcpy(char *restrict dst, const char *restrict src);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)): stpcpy():
    Since glibc 2.10:
        _POSIX_C_SOURCE >= 200809L
    Before glibc 2.10:
        _GNU_SOURCE
 

DESCRIPTION

stpcpy() is similar to strcpy(3), but returns a pointer to the terminating null byte in dst. It is equivalent to all of the following expressions: memset(mempcpy(dst, src, strlen(src)), [aq][rs]0[aq], 1); strcpy(mempcpy(dst, src, strlen(src)), ""); strcpy(dst, src) + strlen(src)  

RETURN VALUE

This function returns a pointer to the terminating null byte of the copied string.  

ATTRIBUTES

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

STANDARDS

POSIX.-2008.  

HISTORY

POSIX.-2008.  

EXAMPLES

#include <err.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) {
    char    *p;
    char    *buf1;
    size_t  len, size;
    size = strlen("Hello ") + strlen("world") + strlen("!") + 1;
    buf1 = malloc(sizeof(*buf1) * size);
    if (buf1 == NULL)
        err(EXIT_FAILURE, "malloc()");
    p = buf1;
    p = stpcpy(p, "Hello ");
    p = stpcpy(p, "world");
    p = stpcpy(p, "!");
    len = p - buf1;
    printf("[len = %zu]: ", len);
    puts(buf1);  // "Hello world!"
    free(buf1);
    exit(EXIT_SUCCESS); }  

SEE ALSO

strcpy(3), string(3), wcpcpy(3), string_copying(7)


 

Index

NAME
LIBRARY
SYNOPSIS
DESCRIPTION
RETURN VALUE
ATTRIBUTES
STANDARDS
HISTORY
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: 11.2 ms