C语言中dirent类型的d_type成员

太之初一 posted @ 2016年4月22日 11:30 in C with tags c 基础 , 4105 阅读

dirent是一个定义于dirent.h中的结构体,用于控制目录文件。

其定义如下:

struct dirent
{
#ifndef __USE_FILE_OFFSET64
    __ino_t d_ino;
    __off_t d_off;
#else
    __ino64_t d_ino;
    __off64_t d_off;
#endif
    unsigned short int d_reclen;
    unsigned char d_type;
    char d_name[256]; /* We must not include limits.h! */
};

其中的d_type数据成员是一个枚举型变量,用于描述文件的类型。其对应的文件类型如下:

/* File types for `d_type'. */
enum
{
    DT_UNKNOWN = 0,
# define DT_UNKNOWN DT_UNKNOWN
    DT_FIFO = 1,
# define DT_FIFO DT_FIFO
    DT_CHR = 2,
# define DT_CHR DT_CHR
    DT_DIR = 4,
# define DT_DIR DT_DIR
    DT_BLK = 6,
# define DT_BLK DT_BLK
    DT_REG = 8,
# define DT_REG DT_REG
    DT_LNK = 10,
# define DT_LNK DT_LNK
    DT_SOCK = 12,
# define DT_SOCK DT_SOCK
    DT_WHT = 14
# define DT_WHT DT_WHT
};
Avatar_small
NGO full form 说:
2022年8月04日 01:46

NGO is Non Governmental Organization and it is an independent organization which is a nonprofit group. These NGOs also referred to as civil societies and organized at national, NGO full form Community or international level with an aim to serve for social or political growth by meeting environmental or humanitarian causes. NGO do play a vital role in the development of nations with their international aid and other philanthropy. These organizations are fully not profit based and can run with a budget of millions which can also grow to billions every financial year.

Avatar_small
Gujarat STD-4 Questi 说:
2022年9月12日 17:02

GSEB STD-4 Model Paper 2023 Pdf Download for Gujarat State Elementary Level Primary School 4th Class Question Paper Pdf with Answers for Gujarati Medium, Hindi Medium, English Medium & Urdu Medium Students of Gandhinagar Board at Gujarat STD-4 Question Paper. Subject experts of the state and teaching staff of private schools have prepared and suggested the GSEB STD-4 Model Paper 2023 Pdf for Part-A, Part-B, Part-C and Part-D exams. Set wide solved question paper suggested as Gujarat Board 4th Class Model Paper 2023.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter