1#include "string/strcpcvt.h"
20 UNREFERENCED_PARAMETER(cp2);
22 int nRet=MultiByteToWideChar(cp,0,str,str.
GetLength(),szBuf,1024);
27 if(GetLastError()==ERROR_INSUFFICIENT_BUFFER)
29 int nRet=MultiByteToWideChar(cp,0,str,str.
GetLength(),NULL,0);
32 wchar_t *pBuf=
new wchar_t[nRet];
33 MultiByteToWideChar(cp,0,str,str.
GetLength(),pBuf,nRet);
45 int nRet=WideCharToMultiByte(cp,0,str,str.
GetLength(),szBuf,1024,NULL,NULL);
46 if(nRet>0)
return SStringA(szBuf,nRet);
47 if(GetLastError()==ERROR_INSUFFICIENT_BUFFER)
49 int nRet=WideCharToMultiByte(cp,0,str,str.
GetLength(),NULL,0,NULL,NULL);
52 char *pBuf=
new char[nRet];
53 WideCharToMultiByte(cp,0,str,str.
GetLength(),pBuf,nRet,NULL,NULL);
static SStringA CvtA2A(const SStringA &str, unsigned int cpFrom=CP_UTF8, unsigned int cpTo=0)
Converts a multi-byte string from one code page to another multi-byte code page.
static SStringA CvtW2A(const SStringW &str, unsigned int cp=0)
Converts a wide string (UTF-16) to a multi-byte string (ANSI or specified code page).
static SStringW CvtA2W(const SStringA &str, unsigned int cp=0, unsigned int cp2=0)
Converts a multi-byte string (ANSI or specified code page) to a wide string (UTF-16).
static SStringW CvtW2W(const SStringW &str, unsigned int cp=0)
Converts a wide string (UTF-16) to another wide string (UTF-16) with a specified code page.
A class representing an ASCII string.
int GetLength() SCONST
Retrieves the length of the string.
A class representing an ASCII string.
int GetLength() SCONST
Retrieves the length of the string.