Hi,
I have been struggling with this problem for some hours now.
I want to copy a certain part of a textline.
I have tried a few approches and at the moment I am using strtok to split the text up but I don't know how to get the text after splitting it.
This is the line I'm working on:
<td align="left" valign="top"class="valuetxt" style="cursor:pointer;color:#0066FF;" onClick="javascript:rowedit('80440');"> 1 </td>
(the bold part is what I'm after)
and this is my most successful code so far:
Code:
char sep[6]= " ";
char *result = NULL;
result = strtok(c, sep);
while(result != NULL){
printf("%s\n", result);
result = strtok(NULL, sep);
c is where the textline is located and read from.
Here I am able with the help of strtok to list up all of the splits from the textline and the second last is the one I want.
Is this a bad approch?
Any hint/tip is appreciated.
----------------------------------------------------------------
I was able to figure out a solution:
Code:
result = strtok(c, sep);
while(result != NULL){
//printf("%s\n", result);
result = strtok(NULL, sep);
if (strstr(result, "\">")!= NULL){
result = strtok(NULL, sep);
printf("%s \n", result);
break;
}
}