programing

디렌트 구조의 구성원

stoneblock 2023. 9. 21. 20:03

디렌트 구조의 구성원

저는 distent.h 라이브러리로 작업을 시작했고 제 책에서 distent *p->d_name 구조를 가진 "struct distent" 구조의 매우 유용한 멤버를 발견했습니다.그러나 유감스럽게도 이 구조의 다른 구성원들에 대해서는 언급되어 있지 않습니다.

이 구조물의 부재들은 또 어떤 용도로 사용되고 있는지 궁금합니다.

안부 전해요

구조는,struct dirent디렉토리 항목을 참조합니다.

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

리눅스에서는 다음과 같이 정의됩니다.

struct dirent {
    ino_t          d_ino;       /* inode number */
    off_t          d_off;       /* offset to the next dirent */
    unsigned short d_reclen;    /* length of this record */
    unsigned char  d_type;      /* type of file; not supported
                                   by all file system types */
    char           d_name[256]; /* filename */
};

참조:man readdir

아니면 그냥 "디런트"를 찾아보세요.포함 디렉토리에서 h".

위키백과의 구성원은 2명뿐입니다.

  • ino_t d_ino- 파일일련번호
  • char d_name[]- 항목 이름(NAME_MAX 크기를 초과할 수 없음)

유닉스 사양도 살펴보세요.

@Binyamin Sharet의 위 답변 외에도:

 off_t d_off - file offset
    unsigned short int d_reclen - length of the dirent record
    unsigned short int d_namlen - length of name
    unsigned int d_type - type of file

언급URL : https://stackoverflow.com/questions/12991334/members-of-dirent-structure