When I tried to split a char array in standard c, the problem is that it cannot show full char (only return \n发\n办法 in this example) when input is chinese char with …… just like, 印发……办法 .However, it is okay if the input is abc……def or 印发...办法. Why and how to solve this problem? Any solution in c or c++ is helpful!
#pragma warning(disable:4996)
#include <string.h>
#include <stdio.h>
void split(char* str)
{
char* token;
const char delim[] = "……";
token = strtok(str, delim); //it is a c++ method
while (token != NULL)
{
printf("%s\n", token);
token = strtok(NULL, delim);
}
}
int main()
{
char ipt1[] = "印发……办法";
split(ipt1);
}