/***************************************************************************
                             UnicodeFix.h
                             -------------------
    Begin                : Sat Oct 13, 2001
    Objective            : Fix the broke standard library functions
    Author               : Drew Hall
    Email                : dhall@Zero-Soft.com
 ***************************************************************************/

#include "stdafx.h"


int sendW(SOCKET s, TCHAR *buf, int &len, int flags)
{
   char szCharBuf[len+1];

   if(!WideCharToMultiByte(CP_ACP, NULL, buf, len, szCharBuf, &len, NULL, NULL))
      return UNICODE_ERROR;

   return send(s, szCharBuf, len, flags);
}

int recvW(SOCKET s, TCHAR* buf, int len, int flags)
{
   DWORD dwLen = len, nRet;
   char szCharBuf[len+1];

   nRet = recv(s, szCharBuf, &dwLen, flags);

   if(!MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szCharBuf, &len, buf, len);
      return UNICODE_ERROR;

   return nRet;
}




