You're trying to read something into a pointer (a temporary pointer, no less), which makes no sense (nor does any other part of the example).
AFAIK, void pointer can only be used as a parameter or as a return value of a function...
There's nothing (syntactically) wrong with the first line.
Of course you need a cast, however void pointers are not restricted to parameters or return values.