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

📄 getword.c

📁 一套接口
💻 C
字号:
static char rcsid[] = "$Id: getword.c 6 2007-01-22 00:45:22Z drhanson $";#include <ctype.h>#include <string.h>#include <stdio.h>#include "assert.h"#include "getword.h"int getword(FILE *fp, char *buf, int size,	int first(int c), int rest(int c)) {	int i = 0, c;	assert(fp && buf && size > 1 && first && rest);	c = getc(fp);	for ( ; c != EOF; c = getc(fp))		if (first(c)) {			{				if (i < size - 1)					buf[i++] = c;			}			c = getc(fp);			break;		}	for ( ; c != EOF && rest(c); c = getc(fp))		{			if (i < size - 1)				buf[i++] = c;		}	if (i < size)		buf[i] = '\0';	else		buf[size-1] = '\0';	if (c != EOF)		ungetc(c, fp);	return i > 0;}

⌨️ 快捷键说明

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