#include "stdafx.h"
#include <string.h>
int main(int argc, char* argv[])
{
char *src="qwert";
char buff[256];
int n=2;
strncpy(buff,src,n);
buff[n]='\0';
printf("%s,%d\n",buff,strlen(buff));
return 0;
}
strncpy(buff,src,n);
最新推荐文章于 2022-06-12 19:16:01 发布