I am trying to make a simple code sample, in which I can have a sub-string, into a new string.
My code is below:
char titulo[20];
char line[] = "PRINCIPAL,1.Liga,2.Clubes,3.Jogadores,4.Relatorios,5.Sair;";
char *pos = strchr(line,',');
memcpy(titulo, line,*pos);
The problem, is that when I do:
printf("%s",titulo);
I get something like:
PRINCIPAL,1.Liga,2.Clubes,3.Jogadores,4.Rela