您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetFullPathName函数代码示例

51自学网 2021-06-01 21:08:26
  C++
这篇教程C++ GetFullPathName函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中GetFullPathName函数的典型用法代码示例。如果您正苦于以下问题:C++ GetFullPathName函数的具体用法?C++ GetFullPathName怎么用?C++ GetFullPathName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了GetFullPathName函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: DeleteFiles

static DWORDDeleteFiles(LPTSTR FileName, DWORD* dwFlags, DWORD dwAttrFlags){        TCHAR szFullPath[MAX_PATH];        TCHAR szFileName[MAX_PATH];        LPTSTR pFilePart;        HANDLE hFile;        WIN32_FIND_DATA f;        BOOL bExclusion;        INT res;        DWORD dwFiles = 0;        _tcscpy(szFileName, FileName);        if(_tcschr (szFileName, _T('*')) == NULL &&	   IsExistingDirectory (szFileName))        {	        /* If it doesnt have a / at the end already then on needs to be added */		if(szFileName[_tcslen(szFileName) -  1] != _T('//'))                        _tcscat (szFileName, _T("//"));                /* Add a wildcard after the / */                _tcscat (szFileName, _T("*"));        }	if(!_tcscmp (szFileName, _T("*")) ||           !_tcscmp (szFileName, _T("*.*")) ||           (szFileName[_tcslen(szFileName) -  2] == _T('//') && szFileName[_tcslen(szFileName) -  1] == _T('*')))        {                /* well, the user wants to delete everything but if they didnt yes DEL_YES, DEL_QUIET, or DEL_PROMPT	           then we are going to want to make sure that in fact they want to do that.  */		if (!((*dwFlags & DEL_YES) || (*dwFlags & DEL_QUIET) || (*dwFlags & DEL_PROMPT)))	        {        	        res = FilePromptYNA (STRING_DEL_HELP2);		        if ((res == PROMPT_NO) || (res == PROMPT_BREAK))			        return 0x80000000;		        if(res == PROMPT_ALL)			        *dwFlags |= DEL_YES;	        }	}        GetFullPathName (szFileName,                         MAX_PATH,                         szFullPath,                         &pFilePart);        hFile = FindFirstFile(szFullPath, &f);        if (hFile != INVALID_HANDLE_VALUE)        {                do                {					bExclusion = FALSE;					/*if it is going to be excluded by - no need to check attrs*/					if(*dwFlags & DEL_ATTRIBUTES && !bExclusion)					{						/*save if file attr check if user doesnt care about that attr anyways*/					 if(dwAttrFlags & ATTR_ARCHIVE && !(f.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE))				        bExclusion = TRUE;					 if(dwAttrFlags & ATTR_HIDDEN && !(f.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN))				        bExclusion = TRUE;					 if(dwAttrFlags & ATTR_SYSTEM && !(f.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM))				        bExclusion = TRUE;					 if(dwAttrFlags & ATTR_READ_ONLY && !(f.dwFileAttributes & FILE_ATTRIBUTE_READONLY))			            bExclusion = TRUE;		             if(dwAttrFlags & ATTR_N_ARCHIVE && (f.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE))			            bExclusion = TRUE;		             if(dwAttrFlags & ATTR_N_HIDDEN && (f.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN))			            bExclusion = TRUE;		             if(dwAttrFlags & ATTR_N_SYSTEM && (f.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM))			            bExclusion = TRUE;		             if(dwAttrFlags & ATTR_N_READ_ONLY && (f.dwFileAttributes & FILE_ATTRIBUTE_READONLY))			            bExclusion = TRUE;					}					if(bExclusion)						continue;					/* ignore directories */					if (f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)		                continue;					_tcscpy (pFilePart, f.cFileName);					/* We cant delete ourselves */					if(!_tcscmp (CMDPath,szFullPath))						continue;					TRACE("Full filename: %s/n", debugstr_aw(szFullPath));					/* ask for deleting */					if (*dwFlags & DEL_PROMPT)					{		                ConErrResPrintf(STRING_DEL_ERROR5, szFullPath);		                res = FilePromptYN (STRING_DEL_ERROR6);		                if ((res == PROMPT_NO) || (res == PROMPT_BREAK))//.........这里部分代码省略.........
开发者ID:farp90,项目名称:nativecmd,代码行数:101,


示例2: ConfigFileName

InspIRCd::InspIRCd(int argc, char** argv) :	 ConfigFileName(INSPIRCD_CONFIG_PATH "/inspircd.conf"),	 PI(&DefaultProtocolInterface),	 /* Functor pointer initialisation.	  *	  * THIS MUST MATCH THE ORDER OF DECLARATION OF THE FUNCTORS, e.g. the methods	  * themselves within the class.	  */	 GenRandom(&DefaultGenRandom),	 IsChannel(&DefaultIsChannel),	 IsNick(&DefaultIsNick),	 IsIdent(&DefaultIsIdent){	ServerInstance = this;	FailedPortList pl;	// Flag variables passed to getopt_long() later	int do_version = 0, do_nofork = 0, do_debug = 0,	    do_nolog = 0, do_nopid = 0, do_root = 0;	// Initialize so that if we exit before proper initialization they're not deleted	this->Config = 0;	this->XLines = 0;	this->ConfigThread = NULL;	this->FakeClient = NULL;	UpdateTime();	this->startup_time = TIME.tv_sec;	SocketEngine::Init();	this->Config = new ServerConfig;	dynamic_reference_base::reset_all();	this->XLines = new XLineManager;	this->Config->cmdline.argv = argv;	this->Config->cmdline.argc = argc;#ifdef _WIN32	srand(TIME.tv_nsec ^ TIME.tv_sec);	// Initialize the console values	g_hStdout = GetStdHandle(STD_OUTPUT_HANDLE);	CONSOLE_SCREEN_BUFFER_INFO bufinf;	if(GetConsoleScreenBufferInfo(g_hStdout, &bufinf))	{		g_wOriginalColors = bufinf.wAttributes & 0x00FF;		g_wBackgroundColor = bufinf.wAttributes & 0x00F0;	}	else	{		g_wOriginalColors = FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN;		g_wBackgroundColor = 0;	}#else	srandom(TIME.tv_nsec ^ TIME.tv_sec);#endif	{		ServiceProvider* provs[] =		{			&rfcevents.numeric, &rfcevents.join, &rfcevents.part, &rfcevents.kick, &rfcevents.quit, &rfcevents.nick,			&rfcevents.mode, &rfcevents.topic, &rfcevents.privmsg, &rfcevents.invite, &rfcevents.ping, &rfcevents.pong,			&rfcevents.error		};		Modules.AddServices(provs, sizeof(provs)/sizeof(provs[0]));	}	struct option longopts[] =	{		{ "nofork",	no_argument,		&do_nofork,	1	},		{ "config",	required_argument,	NULL,		'c'	},		{ "debug",	no_argument,		&do_debug,	1	},		{ "nolog",	no_argument,		&do_nolog,	1	},		{ "nopid",	no_argument,		&do_nopid,	1	},		{ "runasroot",	no_argument,		&do_root,	1	},		{ "version",	no_argument,		&do_version,	1	},#ifdef INSPIRCD_ENABLE_TESTSUITE		{ "testsuite",	no_argument,		&do_testsuite,	1	},#endif		{ 0, 0, 0, 0 }	};	int c;	int index;	while ((c = getopt_long(argc, argv, ":c:", longopts, &index)) != -1)	{		switch (c)		{			case 'c':				/* Config filename was set */				ConfigFileName = optarg;#ifdef _WIN32				TCHAR configPath[MAX_PATH + 1];				if (GetFullPathName(optarg, MAX_PATH, configPath, NULL) > 0)					ConfigFileName = configPath;#else				char configPath[PATH_MAX + 1];				if (realpath(optarg, configPath))//.........这里部分代码省略.........
开发者ID:aszrul,项目名称:inspircd,代码行数:101,


示例3: find_file_helper

int find_file_helper(char *includepath, char *origin, char *includefolder, char *actualpath, char *cwd) {    /*     * Finds the file referenced in includepath in the includefolder. origin     * describes the file in which the include is used (used for relative     * includes). actualpath holds the return pointer. The 4th arg is used for     * recursion on Windows and should be passed as NULL initially.     *     * Returns 0 on success, 1 on error and 2 if no file could be found.     *     * Please note that relative includes always return a path, even if that     * file does not exist.     */    // relative include, this shit is easy    if (includepath[0] != '//') {        strncpy(actualpath, origin, 2048);        char *target = actualpath + strlen(actualpath) - 1;        while (*target != PATHSEP)            target--;        strncpy(target + 1, includepath, 2046 - (target - actualpath));#ifndef _WIN32        int i;        for (i = 0; i < strlen(actualpath); i++) {            if (actualpath[i] == '//')                actualpath[i] = '/';        }#endif        return 0;    }    char filename[2048];    char *ptr = includepath + strlen(includepath);    while (*ptr != '//')        ptr--;    ptr++;    strncpy(filename, ptr, 2048);#ifdef _WIN32    if (cwd == NULL)        return find_file_helper(includepath, origin, includefolder, actualpath, includefolder);    WIN32_FIND_DATA file;    HANDLE handle = NULL;    char mask[2048];    GetFullPathName(includefolder, 2048, includefolder, NULL);    GetFullPathName(cwd, 2048, mask, NULL);    sprintf(mask, "%s//*", mask);    handle = FindFirstFile(mask, &file);    if (handle == INVALID_HANDLE_VALUE)        return 1;    do {        if (strcmp(file.cFileName, ".") == 0 || strcmp(file.cFileName, "..") == 0)            continue;        GetFullPathName(cwd, 2048, mask, NULL);        sprintf(mask, "%s//%s", mask, file.cFileName);        if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {            if (!find_file_helper(includepath, origin, includefolder, actualpath, mask))                return 0;        } else {            if (strcmp(filename, file.cFileName) == 0 && matches_includepath(mask, includepath, includefolder)) {                strncpy(actualpath, mask, 2048);                return 0;            }        }    } while (FindNextFile(handle, &file));    FindClose(handle);#else    FTS *tree;    FTSENT *f;    char *argv[] = { includefolder, NULL };    tree = fts_open(argv, FTS_LOGICAL | FTS_NOSTAT, NULL);    if (tree == NULL)        return 1;    while ((f = fts_read(tree))) {        switch (f->fts_info) {            case FTS_DNR:            case FTS_ERR:                fts_close(tree);                return 2;            case FTS_NS: continue;            case FTS_DP: continue;            case FTS_D: continue;            case FTS_DC: continue;        }        if (strcmp(filename, f->fts_name) == 0 && matches_includepath(f->fts_path, includepath, includefolder)) {            strncpy(actualpath, f->fts_path, 2048);            fts_close(tree);//.........这里部分代码省略.........
开发者ID:KoffeinFlummi,项目名称:armake,代码行数:101,


示例4: _tmain

int _tmain(int argc, WCHAR* argv[]){	printf("PROJECT: Capture-HPC/n");    printf("VERSION: 3.0/n");    printf("DATE: October 19, 2009/n");    printf("COPYRIGHT HOLDER: Victoria University of Wellington, NZ/n");    printf("AUTHORS:/n");    printf("/tChristian Seifert ([email
C++ GetFullPathNameA函数代码示例
C++ GetFullPath函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。