When trying to remove / free the ptr character without processing completely strtok_r , this will give me a stack trace error.
I know that you cannot free / remove strtok_r char ptr for free without completing the process of splitting whole lines of strtok_r func.
Can someone tell me how to free char ptr when its subprocess strtok_r ?
char *data = new char[temp->size()+1];//temp is of type string copy(temp->begin(),temp->end(),data); data[temp->size()]='\0'; count = 0; while(pointData != NULL) { if(count == 0) pointData = strtok_r(data,":",&data); else pointData = strtok_r(NULL,":",&data); if(count == 5)//some condition to free data delete[] data;// this produces stack trace error cout<<pointdata<<endl; count++; }
tinku source share