August 30th, 2011 04:26 AM
Is it possible to read text file of type ANSI and unicode using CStdioFile as shown a
Actually I converted my VC .net project from Use Multi-Byte Character Set to Use Unicode Character Set (i.e. Unicode support). Then lot of build errors fixed.
Before in my project, Iím reading the ANSI text file as below
CString l_strValue = _T("");
CString m_strFileName = _T("C:\\Documents and Settings\\PHari\\Desktop\\ASAS.txt");
BOOL l_bResult = false;
l_bResult = l_oStdioFile.Open(m_strFileName,CFile::modeRead,&l_oFileEx);
int count = l_oStdioFile.GetLength();
UINT l_nBytesRead = l_oStdioFile.Read(l_chBuff,1024*10);
int l_nIndex = 0;
for(int l_nCount = 0; l_nCount < (int)l_nBytesRead; l_nCount++)
l_strValue += l_chBuff[l_nCount];
Once I changed my project to Unicode support. With the above code, Iím trying to read the Unicode text file, it is working fine.
But if I try to read the ANSI text file, it is not reading properly. This problem is coming Once I built my project with Unicode support.
Is it possible to read text file of type ANSI and unicode using CStdioFile as shown above? Or where Iím doing wrong?
My requirement is I need to read the text file of type ANSI and Unicode with above code.
Any help is appreciated.
Tags for this Thread
Click Here to Expand Forum to Full Width