question about File I/O

In my programing,when I use CFile::Read(string,file->GetLength())to read the file and display the string
in a Edit Box
however,sometimes at the end of the content ,there comes
some unexpected characters,sometimes there is no this kind of char,
could you tell me why and what shoul I do?

In addition to what VinExpert said a much easier way to read strings (just text data) is to use the CStdioFile class which is derived from CFile. This class is very easy to use and null terminates the strings. Also you read/write into a CString object and don't have to worry about allocating memory. ;-)

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes. I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.
Introductio…

Introduction:
Ownerdraw of the grid button. A singleton class implentation and usage.
Continuing from the fifth article about sudoku.
Open the project in visual studio.
Go to the class view – CGridButton should be visible as a class. R…