char* UTF8toANSI(char *pszCode)
{
    BSTR    bstrWide;   
    char*   pszAnsi;   
    int     nLength;       
 
    // Get nLength of the Wide Char buffer   
    nLength = MultiByteToWideChar(CP_UTF8, 0, pszCode, lstrlen(pszCode) + 1,NULL, NULL);
    bstrWide = SysAllocStringLen(NULL, nLength);   
 
    // Change UTF-8 to Unicode (UTF-16)   
    MultiByteToWideChar(CP_UTF8, 0, pszCode, lstrlen(pszCode) + 1, bstrWide, nLength);
 
    // Get nLength of the multi byte buffer    
    nLength = WideCharToMultiByte(CP_ACP, 0, bstrWide, -1, NULL, 0, NULL, NULL);
    pszAnsi = new char[nLength];   
    
    // Change from unicode to multi byte   
    WideCharToMultiByte(CP_ACP, 0, bstrWide, -1, pszAnsi, nLength, NULL, NULL);
 
    SysFreeString(bstrWide);   
 
    return pszAnsi;   
}