#include <stdio.h> #include <stdlib.h> char* strncpy(char *dest,char *src,unsigned int n){ char *strRtn=dest; while(n && (*dest++=*src++)){ n--; } printf("n:%d/n",n); if(n) { while(--n) *dest++; } return strRtn; } int main(){ char* dest=(char*)malloc(sizeof(char)*100); char *src="helloworld!"; printf("%s/n",strncpy(dest,src,300)); }
以上就是阔达唇彩最近收集整理的关于strncpy的源代码实现的全部内容,更多相关strncpy内容请搜索靠谱客的其他文章。
发表评论 取消回复