Go to the first, previous, next, last section, table of contents.


memccpy

Syntax

#include <string.h>

void * memccpy(void *to, const void *from, int ch, size_t nbytes)

Description

This function copies characters from memory area from into to, stopping after the first occurrence of character ch has been copied, or after nbytes characters have been copied, whichever comes first. The buffers should not overlap.

Return Value

A pointer to the character after the copy of ch in to, or a NULL pointer if ch was not found in the first nbytes characters of from.

Portability

not ANSI, not POSIX

Example

char inpbuf[256], dest[81];

printf("Enter a path: ");
fflush(stdout);
gets(inpbuf);
memset(dest, 0, sizeof(dest));
if (memccpy(dest, inpbuf, '\\', 80))
  printf("The first directory in path is %s\n", dest);
else
  printf("No explicit directory in path\n");


Go to the first, previous, next, last section, table of contents.