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

📄 find.txt

📁 [随书类]Dos6.0源代码
💻 TXT
字号:
SUMMARY ffirst fnext

#include <tools.h>

int ffirst(pstrPattern, attr, pFindBuf)
char *pstrPattern;
int attr;
struct findType *pFindBuf;

int fnext(pFindBuf)
struct findType *pFindBuf;

DESCRIPTION

Uses the DOS functions 4E, ffirst, and 4F, fnext, to enumerate files
matching the pattern pstrPattern and having the attributes attr.  The find
buffer is filled in.

Call ffirst to find the first file.  Call fnext for each subsequent file.

	int ffirst(pstrPattern, attr, pFindBuf)

	file	char pointer to name string with pattern in last component.
	attr	inclusive attributes for search
	fbuf	pointer to buffer for find stuff

	int fnext(pFindBuf)

	fbuf	pointer to find buffer

RETURN VALUE

Returns zero if no error, i.e. file found returns zero.  Returns non-zero
on error, i.e. file NOT found returns non-zero.

	returns	(DOS) TRUE if error, FALSE if success
	(OS2) error code or NO_ERROR


IMPLEMENTATION

ffirst:
    pass address of find buffer to dos using function 1a
    call function 4e with pattern and attribute

fnext:
    pass address of find buffer to dos using function 1a
    call function 4f

SEE ALSO  forfile 

NOTE

Patterns and attributes are described separately.

EXAMPLE

#include <tools.h>

main(c, argv)
int c;
char *argv[];
{
    struct findType findBuf;
    char str[MAXPATHLEN];

    if (ffirst ("*.c", A_A, &findBuf))
	printf("No files found\n");
    else {
	printf("File found %s\n", findBuf.name);
	while (!fnext(&findBuf))
	    printf("File found %s\n", findBuf.name);
	}
}

⌨️ 快捷键说明

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