Hi friends,
i have a file which is having Japanese string what my code is doing is:
read from ansi and convert to unicode , but i hard code the buffer as 1024 .. with this its giving problem .. so what i thought get the line by line count and allocate memory .... for that char and tchar.. but not wrking..
here is the code
do
{
Lengith = GetFileContent() + 1;
HANDLE hFileMac = m_pFile;
char*szMBuf = new char[Lengith];
memset(szMBuf, 0, Lengith + 1);
TCHAR*cszMBuf = new TCHAR[Lengith];
memset(cszMBuf, 0, Lengith + 1);
if ((lBytes = ::PReadFromFile(hFileMac, szMBuf, Lengith, TRUE)) < 0L)
{
::CloseHandle(hFileMac);
}
str1 = szMBuf;
int nLen = MultiByteToWideChar(932, 0, str1, -1, NULL, NULL);
int i = MultiByteToWideChar(932, 0, str1, -1, cszMBuf, nLen);
if (nBOM == 0) { arcOut.Write(&bom, 2); }
arcOut.WriteString(cszMBuf);
memset(szMBuf, 0, lBytes + 1);
} while (lBytes == Lengith);