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

📄 toolsfiles.h

📁 C++ image processing.Mainly it occupies some filters to detect some prperties of image. Release.
💻 H
字号:
/* 

This "SOFTWARE" is a free software.

You are allowed to download, use, modify and redistribute this software.
The software is provided "AS IS" without warranty of any kind.

Copyright: University of Koblenz-Landau, Dirk Balthasar

*/


/**
\author Dirk Balthasar, 2002, private
*/

#include <stdio.h>

/**
	This file specifies operations for handling filenames
    @ingroup file-tools
  */

namespace tools
{
	/// remove extension of file: "File.***" -> "File"
	inline std::string CutExtension(const char *Fname)
	{
		int FileNameEnd = strlen(Fname);
		while (FileNameEnd > 0)
		{ // find position where programname starts in "path\program.extension"
			char c = Fname[FileNameEnd];
			if (c == '.') break;
			FileNameEnd--;
		}
		
		FileNameEnd--;
		if (FileNameEnd >= 0)
		{	
			char * Rvalue = new char[FileNameEnd+2];
			Rvalue[FileNameEnd+1] = '\0';
			memcpy(Rvalue, Fname, FileNameEnd+1);
			std::string r = Rvalue;
			delete Rvalue;
			return r;
		}else
			return "";
	}
	/// returns true if file exists
	inline bool FileExists(const char *FileExists)
	{
		if (strlen(FileExists) == 0)
		{
			// handle some windows bugs
			return false;
		}
		FILE *fh = fopen(FileExists,"rb");
		if (fh == 0)
			return false;
		fclose(fh);
		return true;
	}
}

⌨️ 快捷键说明

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