matchext.c

来自「[随书类]Dos6.0源代码」· C语言 代码 · 共 37 行

C
37
字号
/***************************************************************************/
/*																									*/
/*	MATCHEXT.C																					*/
/*																									*/
/*		Copyright (c) 1991 - Microsoft Corp.											*/
/*		All rights reserved.																	*/
/*		Microsoft Confidential																*/
/*                                                                         */
/* Checks a file name to see if it's extension exists in a list of         */
/* different extensions. Returns the index to the first matching extension */
/* NOTE: the filename may consist of the full path to the file.				*/
/*                                                                         */
/* int FindExtMatch( char *szFile, char **szExt )									*/
/* 																								*/
/* ARGUMENTS:	szFile - Ptr to filename to chech for a matching extension	*/
/* RETURNS: 	int	 - Index to matching extension in the list or -1		*/
/* 																								*/
/* johnhe - 10/30/89																			*/
/***************************************************************************/

#include    <stdio.h>
#include 	<string.h>

#include 	<strlib.h>

int FindExtMatch( char *szFile, char **szExt )
{
	register 	iMatch;

	iMatch = -1;
	szFile = ParseFileName( szFile );
	if ( (szFile = strchr( szFile, '.' )) != NULL )
		iMatch = StrSearch( szFile + 1, szExt );

	return( iMatch );
}

⌨️ 快捷键说明

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