[C++]涉及文件操作的各种函数整理, 提供文件及路径常用操作

本文主要是对涉及文件操作的各种函数整理, 提供文件及路径常用操作,后续会不定期更新,欢迎大家一起学习交流~在VS2008下编译生成目标动态库文件,使用多字节,编译测试通过,以下是源代码相关:FilesOperationEx.h文件内容如下:// FilesOperationEx.h : main header file for the FilesOperationEx DLL///******
摘要由CSDN通过智能技术生成

本文主要是对涉及文件操作的各种函数整理, 提供文件及路径常用操作,后续会不定期更新,欢迎大家一起学习交流~

在VS2008下编译生成目标动态库文件,使用多字节,编译测试通过,以下是源代码相关:

FilesOperationEx.h文件内容如下:

// FilesOperationEx.h : main header file for the FilesOperationEx DLL
//
/************************************************************************/
/* Copyright (c) 2017, by 1031800228@qq.com    
/* All rights reserved.													
/*																		
/* 文件名称: FilesOperationEx.h												
/* 文件标识: 
/* 摘要: 对涉及文件操作的各种函数进行汇总, 提供文件及路径常用操作
/* 当前版本: 1.0
/* 作者: 1031800228@qq.com
/* 完成日期: 2017年12月22日
/************************************************************************/

#pragma once

#ifndef __AFXWIN_H__
	#error "include 'stdafx.h' before including this file for PCH"
#endif

#include "resource.h"		// main symbols
#include <fstream>
#include <iostream>

using namespace std;

// CFilesOperationExApp
// See FilesOperationEx.cpp for the implementation of this class
//

class CFilesOperationExApp : public CWinApp
{
public:
	CFilesOperationExApp();

	//************************************************************************
	// Author:    2017/08/16 add by 1031800228@qq.com
	// Method:    filesEx_ExistsFileName
	// FullName:  CFilesOperationExApp::ExistsFileName
	// Access:    public  
	// Returns:   BOOL
	// Parameter: const CString & strFileName
	// Qualifier:
	// Description: 判断一个文件是否存在
	//************************************************************************
	BOOL filesEx_ExistsFileName(const CString &strFileName);

	//************************************************************************
	// Author:    2017/08/16 add by 1031800228@qq.com 
	// Method:    filesEx_MyCreatePath
	// FullName:  CFilesOperationExApp::filesEx_MyCreatePath
	// Access:    public  
	// Returns:   BOOL
	// Parameter: const CString & strPath
	// Qualifier:
	// Description: 创建一个目录,如果存在则不创建
	//************************************************************************
	BOOL filesEx_MyCreatePath(const CString &strPath);

	//************************************************************************
	// Author:    2017/07/24 add by 1031800228@qq.com
	// Method:    filesEx_CalcFilesCntForAFolder
	// FullName:  CFilesOperationExApp::CalcFilesCntForAFolder
	// Access:    public  
	// Returns:   int
	// Parameter: const CString & strFolderPath
	// Qualifier:
	// Description: 计算一个文件夹下的文件个数
	//************************************************************************
	int filesEx_CalcFilesCntForAFolder(const CString &strFolderPath);

	//************************************************************************
	// Author:    2017/12/22 add by 1031800228@qq.com 
	// Method:    filesEx_GetCurrentAppPath
	// FullName:  CFilesOperationExApp::filesEx_GetCurrentAppPath
	// Access:    public  
	// Returns:   CString
	// Qualifier:
	// Description: 获取本执行程序所在的路径
	//************************************************************************
	CString filesEx_GetCurrentAppPath();

	//************************************************************************
	// Author:    2017/12/22 add by 1031800228@qq.com
	// Method:    filesEx_IsPathExist
	// FullName:  CFilesOperationExApp::filesEx_IsPathExist
	// Access:    public  
	// Returns:   BOOL
	// Parameter: const CString & strPath
	// Qualifier:
	// Description: 判断目标路径是否存在
	//************************************************************************
	BOOL filesEx_IsPathExist(const CString &strPath);

	//************************************************************************
	// Author:    2017/12/22 add by 1031800228@qq.com
	// Method:    filesEx_IsFileExist
	// FullName:  CFilesOperationExApp::filesEx_IsFileExist
	// Access:    public  
	// Returns:   BOOL
	// Parameter: const CString & strFileName
	// Qualifier:
	// Description: 判断目标文件是否存在
	//************************************************************************
	BOOL filesEx_IsFileExist(const CString &strFileName);

	//************************************************************************
	// Author:    2017/12/22 add by 1031800228@qq.com 
	// Method:    filesEx_CreateMultiLevelPath
	// FullName:  CFilesOperationExApp::filesEx_CreateMultiLevelPath
	// Access:    public  
	// Returns:   BOOL
	// Parameter: const CString & strPath
	// Qualifier: strPath 合法: "D:\\abc\\me" 或 "me\\you" 或 ""; 不合法: "D:\\abc\\me\\" 或 "me\\you\\" 或 "\\";
	// Description: 创建一个多层目录,如果存在就不创建
	//************************************************************************
	BOOL filesEx_CreateMultiLevelPath(const CString &strPath);

	//************************************************************************
	// Author:    2017/12/22 add by 1031800228@qq.com 
	// Method:    filesEx_MyWriteIniFile
	// FullName:  CFilesOperationExApp::filesEx_MyWriteIniFile
	// Access:    public  
	// Returns:   BOOL
	// Parameter: const CString & strFilePath
	// Parameter: const CString & strSession
	// Parameter: const CString & str
	// Qualifier:
	// Description: 写INI格式日志信息到指定文件
	//************************************************************************
	BOOL filesEx_MyWriteIniFile(const CString& strFilePath, const CString& strSession, const CString& str);

	//************************************************************************
	// Author:    2017/12/22 add by 1031800228&
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值