alright it worked now but i got now one problem left that end doesnt specify anything
Right:
To modify a pointer in a called function, you'll need to pass a pointer to it (a pointer to a pointer).
#include <stdio.h>
#include <string.h>
int ParseCh(char *S,char *buff,int num,char **End) {
int i,temp=0;
for(i=0;S[i]!=0;i++) {
if(S[i]==',' || S[i]=='\n' || S[i]=='\t' || i==num) {
puts("found it");
temp=1;
*End=&S[i]+1;
S[i]=0;
break;
}
}
if(temp)
strcpy(buff,S);
else {
*End=0;
i=0;
}
return i;
}
int main(void)
{
char Name2[]="NAME,M";
char Name[10]={0};
char *End;//last string after the , or new lines etc if its initlised to 0 it means there was no , new lines or tab inside the string
ParseCh(Name2,Name,5,&End);
printf("Name after being parsed %s and it ended at %s\n",Name,End);
return 0;
}