#define _crt_secure_no_warnings
#include <stdlib.h>
#include <string.h>
#include <
the use of stdio.h>//STRCHR () strncpy () and the cutting string
int splitstring (char* p1, char C, char buffer[10][30], int * Based on a character Count) {
char* p = null, *ptmp = NULL;
int tempcount = 0;
p = p1;
Ptmp = p1;
while (*p!= ' I ') {
p = STRCHR (P, c);//Check the position p (
p!=null)
{
if (p-ptmp>0)//To calculate the position of the pointer that matches the condition
{
strncpy (buffer[tempcount],ptmp,p-ptmp);
BUFFER[TEMPCOUNT][P-PTMP] = ' tempcount++ ';//Become a C-style string
;
ptmp = p = p + 1;
}}
else {break
;
}
}
*count = tempcount;//specifically has several split strings return
0;
}
void Main () {
int ret = 0, i = 0;
char* p1 = "ABCDEF,ACCCD,BDDDDFDF,FFFF,KJKJLKJKL";
Char SPLITC = ', ';
int ncout;
Char myarray[10][30];
ret = Splitstring (P1, SPLITC, myarray, &ncout);
for (i = 0; i < ncout i++)
{
printf ("%s\n", Myarray[i]);
System ("pause");
}