blob: b504a81966d44a2070ca9af0d7fdb118dd3d56f8 [file]
<html lang="en">
<head>
<title>memccpy - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Strings.html#Strings" title="Strings">
<link rel="prev" href="index.html#index" title="index">
<link rel="next" href="memchr.html#memchr" title="memchr">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="memccpy"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="memchr.html#memchr">memchr</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="index.html#index">index</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Strings.html#Strings">Strings</a>
<hr>
</div>
<h3 class="section">5.5 <code>memccpy</code>&mdash;copy memory regions with end-token check</h3>
<p><strong>Synopsis</strong>
<pre class="example"> #include &lt;string.h&gt;
void* memccpy(void *restrict <var>out</var>, const void *restrict <var>in</var>,
int <var>endchar</var>, size_t <var>n</var>);
</pre>
<p><strong>Description</strong><br>
This function copies up to <var>n</var> bytes from the memory region
pointed to by <var>in</var> to the memory region pointed to by
<var>out</var>. If a byte matching the <var>endchar</var> is encountered,
the byte is copied and copying stops.
<p>If the regions overlap, the behavior is undefined.
<p><br>
<strong>Returns</strong><br>
<code>memccpy</code> returns a pointer to the first byte following the
<var>endchar</var> in the <var>out</var> region. If no byte matching
<var>endchar</var> was copied, then <code>NULL</code> is returned.
<p><br>
<strong>Portability</strong><br>
<code>memccpy</code> is a GNU extension.
<p><code>memccpy</code> requires no supporting OS subroutines.
<p><br>
</body></html>