I am trying to read in input from the command line using a pthread. The pthread would call a reading function. Having some trouble with this and I have read the POSIX documentation. Appreciate the help!
int main(int argc , char *argv[])
{
pthread_t client_thread; // client thread
int rc;
string msg;
cout<<"Please enter a message to send to the server: "<<endl;
pthread_create(&client_thread, NULL, readerT, &msg);
cout<<"Msg is: "<<msg<<endl;
return 0;
}
void * readerT(string * temp)
{
cout<<"GOT IN HERE:\n"<<endl;
getline(cin,*temp);
}
Current Error Msg:
Client.cpp: In function ‘int main(int, char**)’:
Client.cpp:33: error: invalid conversion from ‘void* (*)(std::string*)’ to ‘void* (*)(void*)’
Client.cpp:33: error: initializing argument 3 of ‘int pthread_create(pthread_t*, const pthread_attr_t*, void* (*)(void*), void*)’