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

📄 dirent.h

📁 一款标准c类库.Tima(TM-Tiny&Miny) Standard ANSI C based Library
💻 H
字号:
/**
 * Tima Standard ANSI C based Library
 *
 * Copyright (C) 2008 heiyeluren. All rights reserved.
 *
 * Open-source ANSI C library powered by  TieMa(TIMA) Studio.
 *  
 * Use and distribution licensed under the BSD license.  See
 * the LICENSE file for full text.
 *
 * To learn more open-source code, http://heiyeluren.googlecode.com
 * My blog: http://blog.csdn.net/heiyeshuwu
 *
 * $Id: string.c 2008-11-16 16:01 heiyeluren $
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>		/* flags for read and write */
#include <sys/types.h>	/* typedefs */
#include <sys/stat.h>	/* structure returned by stat */

#ifndef NAME_MAX
# define NAME_MAX 255	/* longest filename component; */
#endif

#ifndef DIRSIZ
# define DIRSIZ 255
#endif


/* system-dependent */
typedef struct {			/* portable directory entry */
	long ino;				/* inode number */
	char name[NAME_MAX+1];	/* name + '\0' terminator */
} Dirent;

typedef struct {			/* minimal DIR: no buffering, etc. */
	int fd;					/* file descriptor for the directory */
	Dirent d;				/* the directory entry */
} DIR;

struct direct {				/* directory entry */
	ino_t d_ino;			/* inode number */
	char d_name[DIRSIZ];	/* long name does not have '\0' */
};



/* function define */
#define dirfd(dir)				((dir)->fd)
#define rewinddir(dir)			(lseek((dir)->fd, 0, SEEK_SET))
#define seekdir(dir, offset)	(lseek((dir)->fd, offset, SEEK_SET))

DIR *opendir(const char *name);
DIR *fdopendir(int fd);
int closedir(DIR *dir);
struct dirent *readdir(DIR *dir);
int scandir(const char *dir, struct dirent ***namelist, int(*filter)(const struct dirent *), int(*compar)(const struct dirent **, const struct dirent **));


⌨️ 快捷键说明

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