2012年3月4日

strncpy的c++实现

摘要: char *strncpy(char* dest,const char*src,int n){ char c; char *s=dest; if(n>=4) { size_t n4=n>>4; for(;;) { c=*src++; *dest++=c; if(c=='\0') break; c=*src++; *dest++=c; if(c=='\0') break; c=*src++; *dest++=c; if(c=='\0') break; c=*src++; *dest++=c; if(c=='\0') 阅读全文

posted @ 2012-03-04 21:57 siauhoo 阅读(420) 评论(0) 推荐(0)

strcpy的C++实现

摘要: char *strcpy(char *strDestination,const char*strSource){ assert(strDestination&&strSource); char *strD=strDestination; while((*strDestination++=*strSource++)!='\0' NULL; return strD;} 阅读全文

posted @ 2012-03-04 21:56 siauhoo 阅读(131) 评论(0) 推荐(0)

导航