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

📄 basefun.h

📁 此源代码只用于学习,不得用于其他商业活动 .
💻 H
字号:
/*

* Copyright 2002 LinkAge Co.,Ltd. Inc. All Rights Reversed

*/



/*********************************************************************************/

/*** Name             : BASEFUN.H                                              ***/

/***                                                                           ***/

/*** Description      : 基本功能函数                                           ***/

/***                                                                           ***/

/*** Author           : 郭亮                       	                       ***/

/***                             	                                       ***/

/*** Begin Time       : 2002/05/26                                             ***/

/***                                                                           ***/

/*** Last Change Time : 2002/05/30       	                               ***/

/*** Revision History : 2003/08/28	修改readdir_r的声明

										**/

/***                                                                           ***/

/*********************************************************************************/



#ifndef BASEFUN_H_

#define BASEFUN_H_



#include <stdio.h>

#include <dirent.h>

#include <errno.h>

#include "c++dcl.h"

/*********************************************************************************/

/***                           Standard Include                                ***/

/*********************************************************************************/



extern int errno;



/*********************************************************************************/

/***                           General Constants                               ***/

/*********************************************************************************/



#ifndef LENGTH

#define LENGTH 255

#endif



const int BUFFSIZE = 8192;

const int TOTAL = 20;



//SearchOneFile的返回值

const int FIND_NOFILE = 0;

const int FIND_NOREAD = -2;

const int FIND_PATHERROR = -1;

const int FIND_OK = 1;





/*********************************************************************************/

/***                           Function Declare                                ***/

/*********************************************************************************/



	/*字符串匹配函数*/

	bool Compare(const char *lv_chCompareString,const char *lv_chCompareMod);

	/*将路径配置完整*/

	int FullPath(char *chPath);

	/*得到系统当前日期(两位年)*/

	void GetShortSystemDate(char *pchCurrentDate);

	/*得到系统当前日期*/	

	void GetSystemDate(char *CurrentDate);

	/*得到系统当前时间*/

	void GetSystemTime(char *CurrentTime);

	/*得到系统当前日期时间(14位YYYYMMDDHHMMSS)*/

	void GetSystemDateTime(char *CurrentDateTime);

	/*得到系统当前日期时间(12位YYMMDDHHMMSS)*/

	void GetShortSystemDateTime(char *CurrentDateTime);

	/*得到本机IP*/

	bool GetLocalIp(char *LocalIp);

	/*获取文件大小*/

	long GetFileSize(const char *chFileName);

	/*去掉字符串左右的空格*/

	void Trim(char * String);

	/*将字符串全部改为大写*/

	void MakeUpper(char * pchString);

	/*将字符串全部改为小写*/

	void MakeLower(char * pchString);

	/*校验日期正确性*/

	bool CheckDate(const char *pchString);

	/*校验时间正确性*/

	bool CheckTime(const char *pchString);

	/*时分秒转换为秒*/

	long hhmmssToss(char * pchString);

	/*从文件中读取一行内容*/

	int GetLine(char *Line,FILE *File);

	/*判断所给路径是否存在*/

	bool IsDirectory(const char *dirname);

	/*按照文件搜索规则查找一个文件*/

	int SearchOneFile(const char *Pathname, const char *Format, char *Filename);

	/*按照文件搜索规则从多个目录中查找一个文件*/

	int SearchOneFile(const char Pathname[TOTAL][LENGTH], const char Format[TOTAL][LENGTH], const int TotalIn, char *Filename);

	bool SearchAllFiles(const char *Pathname, const char *Format, vector<string> &vecFileSet);

	/*将文件从一个目录移动到另外的目录并改名*/

	int MoveFile(const char * DesFullFileName, const char *SrcFullFileName);

	/*将文件从一个目录拷贝到另外的一个目录并改名*/

	int CopyFile(const char * DesFullFileName, const char *SrcFullFileName);

	/*获取文件的行数*/

	long GetFileRows(const char *pchFullFileName);

	/*获取短程序名*/

	void GetShortProcName(char *pchProcName);



#endif		//BASEFUN_H_

⌨️ 快捷键说明

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