www.delorie.com/djgpp/doc/libc/libc_563.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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

ANSI/ISO C No
POSIX No

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");


  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004