I get this error in a c code of mine
error C2440: '=' : cannot convert from 'LPVOID' to 'unsigned char *

if((buffer = HeapAlloc(   
    )) == NULL) {   
        fprintf(stderr, "Memory allocation error\n");   

and even this
error C2440: '=' : cannot convert from 'unsigned char *' to 'LPSTR'

blocks = (WAVEHDR*)buffer;   
    buffer += sizeof(WAVEHDR) * count;   
    for(i = 0; i < count; i++) {   
        blocks[i].dwBufferLength = size;   
        blocks[i].lpData = buffer;   
        buffer += size;   

How do I solve this? I get in windows using visual tudio 2008.I have already turned off unicode setting.

LPSTR is a windows typedef for a void*.

To cast a pointer from one type to another, put the type you're casting it to in front of it:

(char \*) HeapAlloc( ...

This will cast the LPSTR returned from HeapAlloc to a char*.

It's up to you to make sure it's a sensible thing to do.