随笔分类 -  MFC

mfc
摘要:HexToString(const char *szContent, int len, bool bHasSpace){string str = "";for (int i=0; i<len; i++){char strTemp[8] = {0};if (bHasSpace){sprintf(strTemp, "%02X ", (BYTE)szContent[i]);}else{sprintf(strTemp, "%02X", (BYTE)szContent[i]);}str += strTemp;}return str;} 阅读全文
posted @ 2011-09-28 09:12 积木 阅读(1315) 评论(0) 推荐(0)
摘要:Microsoft Visual C++ 2008Redistributable Package (x86) En SP1---vcredist_x86.exehttp://u.115.com/file/bhzxq7iq#vc2008_Redistributable_Package_(x86)_En_SP1.zip 阅读全文
posted @ 2011-07-28 11:18 积木 阅读(232) 评论(0) 推荐(0)
摘要:CStdioFile File; // 定义一个CStdioFile类变量FileCString FileData; // 定义一个CString,作为一个缓冲区//定义n个临时字符串变量,大小依据实际情况,这里暂设为10char TempStr1[10],TempStr2[10]......TempStrN[10];File.ReadString(FileData); // 将一行数据读到缓冲区//将该行数据的n个字符读到n个临时字符串变量sscanf(FileData,"%s %s %s %s ......%s",TempStr1,TempStr2......TempS 阅读全文
posted @ 2011-07-18 14:13 积木 阅读(5210) 评论(0) 推荐(0)
摘要:CFile、CStdioFile、FILE和其他文件操作(转+总结) http://blog.163.com/suredolphin4@126/blog/static/119422262201031083633705/VC++2010-04-10 20:36:33阅读119评论0字号:大中小订阅CFile//创建/打开文件CFile file;file.Open(_T("test.txt"),CFile::modeCreate|CFile::modeNoTruncate|CFile::modeReadWrite);文件打开模式可组合使用,用“|”隔开,常用的有以下几种:CF 阅读全文
posted @ 2011-07-17 00:37 积木 阅读(6708) 评论(0) 推荐(1)
摘要:CStdioFile类的声明保存再afx.h头文件中。CStdioFile类继承自CFile类,CStdioFile对象表示一个用运行时的函数fopen打开的c运行时的流式文件。流式文件是被缓冲的,而且可以以文本方式(默认)或者二进制方式打开。CStdioFile类不支持CFile类中的Duplicate、LockRange、UnlockRange函数,如果你使用了,会得到CNotSupportedException类的错误。CStringFile类默认的是按照Text模式操作文件。CFile 类默认的是按照二进制模式操作文件。这里大致说明一下二进制模式和Text模式的区别。二进制模式:对于一 阅读全文
posted @ 2011-07-17 00:33 积木 阅读(20956) 评论(0) 推荐(2)
摘要:try { CFile file; if ( !file.Open(_T( "C:/text.TXT "),CFile::modeReadWrite)) { // ==========> 这段代码写在DLL中上面这个OPEN失败,,直接写在EXE程序中为正确的。。 } // ………………………… } catch(CFileException* e) { MessageBox( "File Operation Error! "); } 是啊,你不是有“catch(CFileException* e)”吗?错误信息在“e”里面e-> m_caus 阅读全文
posted @ 2011-07-17 00:04 积木 阅读(5312) 评论(0) 推荐(0)