1.单个字节读取设置
#pragma pack(1)
//创建目录
BOOL CreateFolder(CString strPath)
{
SECURITY_ATTRIBUTES attrib;
attrib.bInheritHandle = FALSE;
attrib.lpSecurityDescriptor = NULL;
attrib.nLength =sizeof(SECURITY_ATTRIBUTES);
//上面定义的属性可以省略。 直接return ::CreateDirectory( path, NULL); 即可
return ::CreateDirectory( strPath, &attrib); //当前 目录 多级目录无法创建
}
目录是否存在的检查:
BOOL FolderExist(CString strPath)
{
WIN32_FIND_DATA wfd;
BOOL rValue = FALSE;
HANDLE hFind = FindFirstFile(strPath, &wfd);
if ((hFind != INVALID_HANDLE_VALUE) && (wfd.dwFileAttributes &FILE_ATTRIBUTE_DIRECTORY))
{
rValue = TRUE;
}
FindClose(hFind);
return rValue ;
}
//文件存在性检查:
BOOL FileExist(CString strFileName)
{
CFileFind fFind;
return fFind.FindFile(strFileName);
}
//对字符串操作
CString str="ABCDEF:123456";
CString str1 = str.Right(str.GetLength()-str.Find(":"));
str1=123456
CString str2 = str.Left(str.Find(":"));
str2=ABCDEF