#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-04-05 19:33:53 发布