Hi! I had problem in the next code. In it, I want to carry out a tokenizer for getting some parameters values written in a text file.
In the character chain 'param_cpy' I allocate memory in order to copy a fragment of the text chain being descomposed. After i get the token, a want to release this memory. Howewer, when i try doing it, the program crash in execution time. The instruction causing the problem is marked in red in the code above. I don´t understand the reason which this problem occurs for. Someone could help me?Code:/* Se lee el valor del parámetro Longitud del símbolo Apex */ p_cadena=p_cadena+2; char *param_cpy=(char*)calloc(strlen(&(cadena[p_cadena])),sizeof(char)); strcpy(param_cpy,&(cadena[p_cadena])); char *lg=strtok(param_cpy,","); p_cadena=p_cadena+strlen(lg); *result=sscanf(lg,"%f",l); free(param_cpy);