I have following code to start a new thread
int number = 10;
_beginthread(ModbusReadWrite, 0, (void*)number);
The function is:
void ModbusReadWrite(void *arg)
{
char inBuffer[BUF_SIZE];
int PointNumber = &arg;
...
}
It shows an error:
error C2440: 'initializing' : cannot convert from 'void **' to 'int'
So, I need to define new parameter of type int and pass it to ModbusReadWrite() function. How can I achieve it?
The void* parameter may be used to pass anything. But it makes no sense to take its address:
int PointNumber = (int)arg;