zoukankan      html  css  js  c++  java
  • 关于readdir返回值中struct dirent.d_type的取值有关问题(转)

    关于readdir返回值中struct dirent.d_type的取值问题

    原网页链接

    http://www.gnu.org/software/libc/manual/html_node/Directory-Entries.html

    原文及翻译

    混在一起写了


    unsigned char d_type

        This is the type of the file, possibly unknown. The following constants are defined for its value:

        DT_UNKNOWN
            The type is unknown. Only some filesystems have full support to return the type of the file, others might always return this value.

             类型未知。少数文件系统会出现此函数不支持的文件类型,另一些则总是返回这个值。译者注:总之这个值是为了应对不兼容的文件系统而设置的。


        DT_REG
            A regular file.

            常规文件


        DT_DIR
            A directory.

            目录


        DT_FIFO
            A named pipe, or FIFO. See FIFO Special Files.

            一个命名管道,或FIFO。


        DT_SOCK
            A local-domain socket.

            套接字


        DT_CHR
            A character device.

             字符设备


        DT_BLK
            A block device.

             块设备


        DT_LNK
            A symbolic link. 

             符号链接

    d_type的具体数值

    以下内容转自http://blog.csdn.net/angle_birds/article/details/8503039

     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 
    }; 
  • 相关阅读:
    程序员必须知道的10大基础实用算法及其讲解
    6 Java Exceptions that Haunts a Newbie Java Developer(Java菜鸟6种常见的异常)
    在线学习Java免费资源推荐(来自:importnew)
    Oracle触发器
    Oracle性能分析工具介绍及使用
    开口大数据闭口高并发,你们都是怎么回答
    Http中Get/Post请求区别
    快速排序算法
    MAG EF查询增加指定索引功能
    WEB传参
  • 原文地址:https://www.cnblogs.com/jikexianfeng/p/6225846.html
Copyright © 2011-2022 走看看