<分区>
比如我有这个
char *buff = "this is a test string";
并希望获得“测试”
。我该怎么做?
<分区>
比如我有这个
char *buff = "this is a test string";
并希望获得“测试”
。我该怎么做?
最佳答案
char subbuff[5];
memcpy( subbuff, &buff[10], 4 );
subbuff[4] = '\0';
工作完成:)
关于c - 获取 char* 的子串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4214314/