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

📄 cmd_line.c

📁 C和指针非常好的一本书.里面的有许多代码可以借鉴.
💻 C
字号:
/*
** Process command-line arguments
*/
#include <stdio.h>
#define	TRUE	1

/*
**	Prototypes for functions that do the real work.
*/
void	process_standard_input( void );
void	process_file( char *file_name );

/*
**	Option flags, default initialization is FALSE.
*/
int	option_a, option_b /* etc. */ ;

void
main( int argc, char **argv )
{
	/*
	** Process option arguments: skip to next argument, and
	** check that it begins with a dash.
	*/
	while( *++argv != NULL && **argv == '-' ){
		/*
		** Check the letter after the dash.
		*/
		switch( *++*argv ){
		case 'a':
			option_a = TRUE;
			break;

		case 'b':
			option_b = TRUE;
			break;

		/* etc. */
		}
	}

	/*
	** Process file name arguments
	*/
	if( *argv == NULL )
		process_standard_input();
	else {
		do {
			process_file( *argv );
		} while( *++argv != NULL );
	}
}

⌨️ 快捷键说明

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