I have tried to use qsort to sort a long array in a MFC program.
I have the followinf message
error C2664: 'qsort' : cannot convert parameter 4 from 'int (const
void *,const void *)' to 'int (__cdecl *)(const void *,const void *)
here is my code
void CQuickSortTestDlg::OnBnSort()
{
long vArray[]={9,6,7,6,3,2,1,8,0,4,5,4};
qsort((void*) vArray,(size_t) 12, sizeof(long), compare);
CString str,Msg;
for (int i=0 ; i < 12;i++)
{
str.Format("%d ",vArray[i]);
Msg+=str;
}
MessageBox(Msg);
}
int CQuickSortTestDlg::compare(const void *el1,const void *el2)
{
int res=*((long*)el1) - *((long*)el2);
return res;
}
I have read some documentation about decorated function names.
Should I use such a notation here?
It would be very nice If someone could tell me what is wrong in my
code.
Eric