⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 recordfile.cpp

📁 一个给铁路机车系统采集排气
💻 CPP
字号:
// RecordFile.cpp: implementation of the CRecordFile class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "test.h"
#include "RecordFile.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CRecordFile::CRecordFile()
{

}

CRecordFile::~CRecordFile()
{

}

bool CRecordFile::fnCreateCaseFile(CString CaseName)
{
 //CString strName=fnGetExePath();
	/*if(!fnFindFileOrDir(strName,"RecordFile",false))
	{
		//if(strName.Right(1)!="\\")
			//strName+="\\";
		//strName+="RecordFile";
		::CreateDirectory(CaseName,NULL);
	}
	else
	{
		if(strName.Right(1)!="\\")
			strName+="\\";
		strName+="RecordFile";
	}
	if(strName.Right(1)!="\\")
		strName+="\\";
	strName+=CaseName;*/
	//::CreateDirectory(CaseName,NULL);
	//CFile file(CaseName,CFile::modeCreate);
	return true;
}

bool CRecordFile::fnFindFileOrDir(CString dirpath, CString FOrDName, bool flag)
{
   //flag is true, will find file;is false , will find dir.
	CFileFind ff;
	CString findPath=dirpath;
	if(findPath.Right(1)!="\\")
		findPath+="\\";
	findPath+="*.*";
	BOOL res=ff.FindFile(findPath);
	while(res)
	{
		res=ff.FindNextFile();
		if(ff.IsDirectory()&&(!ff.IsDots()))
		{
			if(flag==true)
			{
				fnFindFileOrDir(ff.GetFilePath(),FOrDName,flag);
				continue;
			}
			if(ff.GetFileName()==FOrDName)
				return true;
		}
		else if(!ff.IsDirectory()&&(!ff.IsDots()))
		{
			if(flag==false)
				continue;
			if(ff.GetFileName()==FOrDName)
				return true;
		}
	}
	return false; 
}

CString CRecordFile::fnGetExePath()
{
    char c[MAX_PATH];
	::GetModuleFileName(NULL,c,MAX_PATH);
	CString str;
	str.Format("%s",c);
	int i=str.ReverseFind('\\');
	if(i!=-1)
		str=str.Left(i);
	return str;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -