home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / compat / string / memccpy.txh < prev    next >
Encoding:
Text File  |  1995-07-10  |  970 b   |  38 lines

  1. @node memccpy, memory
  2. @subheading Syntax
  3.  
  4. @example
  5. #include <string.h>
  6.  
  7. void * memccpy(void *to, const void *from, int ch, size_t nbytes)
  8. @end example
  9.  
  10. @subheading Description
  11.  
  12. This function copies characters from memory area @var{from} into @var{to},
  13. stopping after the first occurrence of character @var{ch} has been copied,
  14. or after @var{nbytes} characters have been copied, whichever comes first.
  15. The buffers should not overlap.
  16.  
  17. @subheading Return Value
  18.  
  19. A pointer to the character after the copy of @var{ch} in @var{to},
  20. or a @code{NULL} pointer if @var{ch} was not found in the first
  21. @var{nbytes} characters of @var{from}.
  22.  
  23. @subheading Example
  24.  
  25. @example
  26. char inpbuf[256], dest[81];
  27.  
  28. printf("Enter a path: ");
  29. fflush(stdout);
  30. gets(inpbuf);
  31. memset(dest, 0, sizeof(dest));
  32. if (memccpy(dest, inpbuf, '\\', 80))
  33.   printf("The first directory in path is %s\n", dest);
  34. else
  35.   printf("No explicit directory in path\n");
  36. @end example
  37.  
  38.