Blame man3/mempcpy.3

Packit 7cfc04
.\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
Packit 7cfc04
.\" Distributed under GPL
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.\"
Packit 7cfc04
.\" Heavily based on glibc infopages, copyright Free Software Foundation
Packit 7cfc04
.\"
Packit 7cfc04
.\" aeb, 2003, polished a little
Packit 7cfc04
.TH MEMPCPY 3 2015-03-02 "GNU" "Linux Programmer's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
mempcpy, wmempcpy  \- copy memory area
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.nf
Packit 7cfc04
.BR "#define _GNU_SOURCE" "         /* See feature_test_macros(7) */"
Packit 7cfc04
.B #include <string.h>
Packit 7cfc04
.PP
Packit 7cfc04
.BI "void *mempcpy(void *" dest ", const void *" src ", size_t " n );
Packit 7cfc04
Packit 7cfc04
.BR "#define _GNU_SOURCE" "         /* See feature_test_macros(7) */"
Packit 7cfc04
.B #include <wchar.h>
Packit 7cfc04
.PP
Packit 7cfc04
.BI "wchar_t *wmempcpy(wchar_t *" dest ", const wchar_t *" src ", size_t " n );
Packit 7cfc04
.fi
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
The
Packit 7cfc04
.BR mempcpy ()
Packit 7cfc04
function is nearly identical to the
Packit 7cfc04
.BR memcpy (3)
Packit 7cfc04
function.
Packit 7cfc04
It copies
Packit 7cfc04
.I n
Packit 7cfc04
bytes from the object beginning at
Packit 7cfc04
.I src
Packit 7cfc04
into the object pointed to by
Packit 7cfc04
.IR dest .
Packit 7cfc04
But instead of returning the value of
Packit 7cfc04
.I dest
Packit 7cfc04
it returns a pointer to the byte following the last written byte.
Packit 7cfc04
.PP
Packit 7cfc04
This function is useful in situations where a number of objects
Packit 7cfc04
shall be copied to consecutive memory positions.
Packit 7cfc04
.PP
Packit 7cfc04
The
Packit 7cfc04
.BR wmempcpy ()
Packit 7cfc04
function is identical but takes
Packit 7cfc04
.I wchar_t
Packit 7cfc04
type arguments and copies
Packit 7cfc04
.I n
Packit 7cfc04
wide characters.
Packit 7cfc04
.SH RETURN VALUE
Packit 7cfc04
.I dest
Packit 7cfc04
+
Packit 7cfc04
.IR n .
Packit 7cfc04
.SH VERSIONS
Packit 7cfc04
.BR mempcpy ()
Packit 7cfc04
first appeared in glibc in version 2.1.
Packit 7cfc04
.SH ATTRIBUTES
Packit 7cfc04
For an explanation of the terms used in this section, see
Packit 7cfc04
.BR attributes (7).
Packit 7cfc04
.TS
Packit 7cfc04
allbox;
Packit 7cfc04
lbw21 lb lb
Packit 7cfc04
l l l.
Packit 7cfc04
Interface	Attribute	Value
Packit 7cfc04
T{
Packit 7cfc04
.BR mempcpy (),
Packit 7cfc04
.BR wmempcpy ()
Packit 7cfc04
T}	Thread safety	MT-Safe
Packit 7cfc04
.TE
Packit 7cfc04
.SH CONFORMING TO
Packit 7cfc04
This function is a GNU extension.
Packit 7cfc04
.SH EXAMPLE
Packit 7cfc04
.EX
Packit 7cfc04
void *
Packit 7cfc04
combine(void *o1, size_t s1, void *o2, size_t s2)
Packit 7cfc04
{
Packit 7cfc04
    void *result = malloc(s1 + s2);
Packit 7cfc04
    if (result != NULL)
Packit 7cfc04
        mempcpy(mempcpy(result, o1, s1), o2, s2);
Packit 7cfc04
    return result;
Packit 7cfc04
}
Packit 7cfc04
.EE
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.BR memccpy (3),
Packit 7cfc04
.BR memcpy (3),
Packit 7cfc04
.BR memmove (3),
Packit 7cfc04
.BR wmemcpy (3)
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.