Hi, I have struct with this definition:
typedef struct gRow{
char *txt;
char *fileName;
int line;
} gRow;
and i want to use strtok on the txt string. so, in some function that has gRow *row
, i do this:
strtok(row->txt, SEPERATOR_CHARACTERS);
and this is the point where i get Segmentation Fault. if i replace it with:
strtok(strdup(row->txt), SEPERATOR_CHARACTERS);
it works just fine. any ideas why?
Thanks.
Shahar.