In the following code I am calling a function from a pthread:
pthread_create(&threads[t], NULL, dnssearch, (void *)buffer)
I need to pass the string (buffer) to a function and the have the function pass a string back. What am I doing wrong in the function:
void *dnssearch (void *buf)
{
char *abc = (void *)buf;
char tur[30],rut[30];
int strncmp(const char *abc, const char *tur, size_t n);
FILE *f;
int c=0,i;
printf("%s\n",abc);
f = fopen("dnsfile", "r");
for (i=0; i<30 && abc[i] != 0xA; i++);
abc[i]='\0';
if ( f != NULL)
{
do
{
fscanf(f, "%s", tur);
if (strncmp(tur,abc,30) == 0)
{
fscanf(f, "%s\n", tur);
printf("%s\n",tur);
strcpy(abc,tur);
printf("%s\n",abc);
}
c=c++;
}
while (c <=10 );
}
fclose(f);
strcpy(buf,abc);
return abc;
}