C语言函数—malloc

函数名

memccpy

功 能

从源source中拷贝n个字节到目标destin中

用 法

void *memccpy(void *destin, void *source, unsigned char ch,

unsigned n);

程序例

#include <string.h> 
#include <stdio.h> 

int main(void) 
{ 
   char *src = "This is the source string"; 
   char dest[50]; 
   char *ptr; 

   ptr = memccpy(dest, src, 'c', strlen(src)); 

   if (ptr) 
   { 
      *ptr = ''; 
      printf("The character was found:  %sn", dest); 
   } 
   else 
      printf("The character wasn't foundn"); 
   return 0; 
} 
  
  

如果引用本站的原创文章,请注明原文链接:,本站保留追究责任的权利!
评论已关闭。