Right, I'm just creating a few functions that will read info from a text file and define the keyboard keys for controling a FPS camera based on the info.
So, I'm using 'malloc' to dynamically allocate space for an array of 'SKeyMap', but when I try to assign it to a 'SKeyMap*' pointer. This is my code:
Code: Select all
SKeyMap* keyMap = NULL;
keyMap = (SKeyMap) malloc( sizeof(SKeyMap) * key_num );
'key_num' is an int that holds the number of keys to be assigned from the file being read.
And the error given is: " error C2440: 'type cast' : cannot convert from 'void *' to 'struct irr::SKeyMap' "
I understand the error, but am not sure how to fix it. Ideas??