Though this seems to be a duplicate question, i could not find an answer that is marked correct. Also I could not find them helpful for my issue
Here is my code
void *testClassdMain(void *temp){
initClassD((int)(temp),(char *)"localhost",10101,(char *)"localhost",10102);
char txt[255]={0,};
int len=0;
while(1){
fgets(txt,255,stdin);
len=strlen(txt);
ClassDSend((uint8_t *)txt, len);
}
return NULL;
}
int main(int argc, char *argv[]){
int mode=0;
if (signal(SIGINT, sig_handler) == SIG_ERR){
printf("Cant catch\n");
return -1;
}
if(!strcmp(argv[1],"server")){
mode=1;
}
pthread_attr_init(&testAttr);
pthread_attr_setdetachstate(&testAttr, PTHREAD_CREATE_JOINABLE);
if(pthread_create(&testThrdId, &testAttr, testClassdMain, (void*)mode )){
printf("Error in creating a thread\n");
return -1;
}
pthread_exit(NULL);
return 0;
}
And while it is trying to create a thread its throwing following error
main.c: In function ‘void* testClassdMain(void*)’:
main.c:30: error: cast from ‘void*’ to ‘int’ loses precision
Please guide me
Thanks in Advance