为什么我把程序改成这样就不能用了啊?
CFile MyFile;
char* buf=new char[1];
MyFile.Open("test.txt",CFile::modeRead);
MyFile.Read((void*)&buf,1);//只读取3位
MyFile.Close();CString strOutput;
strOutput.Format("%d",atoi(buf));
pDC->TextOut(0,0,strOutput);test.txt文件内容如下:3
有人能帮我吗??
万分感谢。。祝帮助我的好人万事如意中秋快乐!
CFile MyFile;
char* buf=new char[1];
MyFile.Open("test.txt",CFile::modeRead);
MyFile.Read((void*)&buf,1);//只读取3位
MyFile.Close();CString strOutput;
strOutput.Format("%d",atoi(buf));
pDC->TextOut(0,0,strOutput);test.txt文件内容如下:3
有人能帮我吗??
万分感谢。。祝帮助我的好人万事如意中秋快乐!
解决方案 »
- abnormal program termination"错误
- 菜鸟关于DragDetect函数问题请教
- socket通信的问题还是没解决?
- ℃ 摄氏度符号如何在多国系统下显示正常
- 请各位帮我看看这个是什么语法,就是股票软件公式里面的,谢谢
- 怎样改变checkbox的字体大小?
- 大家讨论一下SOCKET通信的多客户端处理,讲讲自己是怎样实现的
- 使用BCG,如何在菜单项上面添加ICON
- 请大家帮我看一下 麻烦了
- *****十万火急****如何在ocx控件编写时,加入自定义结构的集合的属性
- 请问,vc中的直方图控件有吗?谁能提供
- 请问如何使用SetTimer()周期性的执行一个函数Capture()?
输出结果依然错误。。求答案。。
CFile MyFile;
char* buf=new char[1];
MyFile.Open("test.txt",CFile::modeRead);
MyFile.Read((void*)&buf,1);//只读取3位
MyFile.Close();//add//只读取3位(3字节?)
buf[3]=0x00;CString strOutput;
strOutput.Format("%d",atoi(buf));
pDC->TextOut(0,0,strOutput);应该可以.
CFile MyFile;
char* buf=new char[1];
if(MyFile.Open("test.txt",CFile::modeRead))
{
MyFile.Read((void*)&buf,1);//只读取3位
MyFile.Close();
}
是对的(而且必须是这样的)。
看看是不是其他错误。