this is starting to bug be now...thanks for the help, to bad its not sinking in...
heres a single file that works:
Code:
int main() {
char test[] = "<test>new idea</test>";
findtag(test, "test");
return 0;
}
int findtag(char *src, char tag[]) {
char *search = NULL;
createtags(&search, "TEST");
printf("search = %s\n", search);
return 0;
}
int createtags(char **dest, char tag[]) {
*dest = malloc(20);
strcpy(*dest, "it works!!");
return 0;
}
that was just something i made up, because i was tired of playing with the real code.
then i then i tried the real code. i get this when i compile it (from gcc)
html_findtags.c: In function `html_findstarttag':
html_findtags.c:21: warning: passing arg 1 of `html_createstarttag' from incompa tible pointer type
and its code
Code:
/* html_findtags.c */
int html_findstarttag(char *src, char tag[]) {
char *search = NULL;
int tmp;
html_createstarttag(&search, tag); /* line21 */
tmp = str_whereisstring(src, search);
free(search);
return tmp;
}
int main() {
char test[] = "<test>new idea</test>";
int x;
x = html_findstarttag(test, "test");
printf("%s\n", x);
return 0;
}
Code:
/* html_createtags.c */
int html_createstarttag(char **dest, char tag[]) {
*dest = malloc( strlen(tag) + 3 );
sprintf(*dest, "<%s>", tag);
return 0;
}
i used it like a template, i think.
what am i missing this time?
this is really bugging me now, sorry.........