1
#include <stdio.h>
#include <string.h>
void envia(char* pdados);
int main()
{
char* link[1000];
strcpy(link,"http://site.com/data.php?dados=");
char* dados = "name";
strcat(link,dados);
//printf("%s\n",link);
envia(link);
}
void envia(char *pdados){
printf("%s\n",pdados);
char comando[2000];
sprintf(comando, "curl %s >> /dev/null", pdados);
system(comando);
}
ERROR:
manda.c: In function ‘main’: manda.c:9:2: warning: passing argument 1 of ‘strcpy’ from incompatible pointer type [enabled by default] strcpy(link,"http://site.com/data.php?dados="); ^ In file included from manda.c:2:0: /usr/include/string.h:129:14: note: expected ‘char * __restrict__’ but argument is of type ‘char **’ extern char *strcpy (char *__restrict __dest, const char *__restrict __src) ^ manda.c:13:2: warning: passing argument 1 of ‘strcat’ from incompatible pointer type [enabled by default] strcat(link,dados); ^ In file included from manda.c:2:0: /usr/include/string.h:137:14: note: expected ‘char * __restrict__’ but argument is of type ‘char **’
Instead of
char* link[1000];
, how about tryingchar link[1000];
, that is, without the*
?– Victor Stafusa