Home > Software engineering >  MFC read the file content shows the code
MFC read the file content shows the code

Time:10-02

CFile file;
Char * p;
CFileException mExcept;
The file Open (wenjianming CFile: : modeRead, & amp; MExcept);
Int ilen=2 * file. GetLength ();
P=new char [ilen + 1];
Ilen memset (p, 0, + 1);
File. Read (p, ilen);
P [ilen];
Wenjianming=p;
file.Close();
The output shows garbled

CodePudding user response:

Hexadecimal view file original content, if non ANSI code, you may need to convert, or use WCHAR access to try

CodePudding user response:

Int main (void)
{
If (IsUnicode (" H: \ \ Unicode TXT "))
Printf (" open the Unicode file \ n ");
The else
Printf (" open the ANSI file \ n ");
return 0;
} Unicode much two byte tags, so Unicode than ANSI a word (Unicode is double byte codes), is the head of the text
  • Related