📄 dirent.h
字号:
/* Define a portable UNIX directory-entry manipulation interface. This code is heavily based upon Doug Gwyn's public domain directory-access routines. Hacked into C++ conformance by Doug Schmidt (schmidt@ics.uci.edu). */#include <builtin.h>#include <sys/types.h>#include <sys/stat.h>#include <dirent.h>#ifdef rewinddir#undef rewinddir#endifclass Dirent{private: DIR *dirp;public: Dirent (char *dirname); ~Dirent (void); struct dirent *readdir (void); void opendir (char *filename); void closedir (void); long telldir (void); void seekdir (long loc); void rewinddir (void);};// error handlersextern void verbose_Dirent_error_handler(const char*);extern void quiet_Dirent_error_handler(const char*);extern void fatal_Dirent_error_handler(const char*);extern one_arg_error_handler_t Dirent_error_handler;extern one_arg_error_handler_t set_Dirent_error_handler(one_arg_error_handler_t);// OPTIMIZE#ifdef __OPTIMIZE__inline Dirent::Dirent (char *dirname) { if ((dirp = ::opendir (dirname)) == 0) (*Dirent_error_handler) ("Dirent::Dirent");}inline Dirent::~Dirent (void){ ::closedir (dirp);}inline voidDirent::opendir (char *dirname) { if ((dirp = ::opendir (dirname)) == 0) (*Dirent_error_handler) ("Dirent::Dirent");}inline struct dirent *Dirent::readdir (void){ return ::readdir (dirp);}inline voidDirent::closedir (void){ ::closedir (dirp);}inline voidDirent::rewinddir (void){ ::seekdir (dirp, long (0));}inline voidDirent::seekdir (long loc){ ::seekdir (dirp, loc);}inline longDirent::telldir (void){ return ::telldir (dirp);}#endif // __OPTIMIZE__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -