摘要: 例程1:(csdn)文件xxxx.dll去掉后面的.dll方法1、char str[] = "xxxx.dll"char*p;p=strrchr(str, '.');*p = 0;方法2、CString str="xxxx.dll";int n = str.ReverseFind('.')str = str.Left(str.GetLength()-n-1);例程2:(csdn)取得一个字符串中第一个'?'号之前的字符方法1CString m_char,m_disp;m_disp="jadfuei 阅读全文
posted @ 2011-09-21 18:33 蝌蚪归来 阅读(8625) 评论(0) 推荐(0) 编辑
摘要: CFile的派生类CStdioFile提供了对文件进行流式的操作功能。其中函数void CStdioFile::WriteString( LPCTSTR lpsz )写入一个字符串,需要给字符串lpsz的末尾加上换行标志”\r\n”;函数bool CStdioFile::ReadString(CString &rString )从文件中读取一行,如果文件未读完返回true,否则返回false。 比如:写入文件的例子 //创建文件 CStdioFile file; file.Open("ts.txt",CFile::modeCreate|CFile::modeWrit 阅读全文
posted @ 2011-09-20 09:42 蝌蚪归来 阅读(3586) 评论(0) 推荐(0) 编辑
摘要: 关于三个SDK函数: WinExec, ShellExecute,CreateProcess 的其他注意事项:【1】定义头文件必须定义以下两个头文件:#include <shlobj.h> // 可替换为 windows.h#include <shellapi.h>如果定义了头文件 #include <windows.h>的话就不必定义 #include <shlobj.h>了。【2】定义路径C++中所表示的路径要用 " \\ "而不是平常所用的" \ ",所以以上三个函数表示路径都为:disk:\\Dir 阅读全文
posted @ 2011-09-19 12:01 蝌蚪归来 阅读(866) 评论(0) 推荐(0) 编辑
摘要: //获取程序根目录方法CString GetAppPath(){ CString strPath; char cCurrentFilePath[255]; int nTemp; GetModuleFileName(NULL, cCurrentFilePath, 255); strPath = cCurrentFilePath; nTemp = strPath.ReverseFind('\\'); strPath = strPath.Left(nTemp+1); return strPath;} 阅读全文
posted @ 2011-09-19 11:15 蝌蚪归来 阅读(1169) 评论(0) 推荐(0) 编辑
摘要: 配置文件中经常用到ini文件,在VC中其函数分别为:写入.ini文件:bool WritePrivateProfileString(LPCTSTR lpAppName,LPCTSTR lpKeyName,LPCTSTR lpString,LPCTSTR lpFileName);读取.ini文件:DWORD GetPrivateProfileString(LPCTSTR lpAppName,LPCTSTR lpKeyName,LPCTSTR lpDefaut,LPSTR lpReturnedString,DWORD nSize,LPCTSTR lpFileName);读取整形值:UINT Get 阅读全文
posted @ 2011-09-19 10:59 蝌蚪归来 阅读(924) 评论(0) 推荐(0) 编辑
摘要: 对文件读写的三种方法 1.C中 FILE *pFile=fopen("1.txt","w");fwrite("http://www.sunxin.org",1,strlen("http://www.sunxin.org"),pFile");//fseek(pFile,0,SEEK_SET);//fwrite("ftp:",1,strlen("ftp:"),pFile);//fwrite("http://www.sunxin.org",1,strl 阅读全文
posted @ 2011-09-19 09:42 蝌蚪归来 阅读(1368) 评论(0) 推荐(0) 编辑