CFile是MFC里的封装的一个类吧。file是一个对象还是什么的。但我觉得应该像C++里面的FILE *fp一样可以把指针拿来传递呀。[/quote]
看了你的代码,明白你的意图了。你的类型不对,造成内存访问出错。
CFile类的Read方法原型:
UINT Read(void *lpBuf,UINT nCount)
第一个参数是以字节为单位的数组,所以只适用于char或者unsigned char。
而你的参数是Long类型。
改一下类型char *pBuf=new char[20];试试。[/quote]
原文定义read:
virtual UINT Read(
void* lpBuf,
UINT nCount
);
Pointer to the user-supplied buffer that is to receive the data read from the file.
用户定义的缓冲都可以。