Nick Craig-Wood <n...@craig-wood.com> writes: > Here is a ctypes generator listdir for unix-like OSes.
ctypes code scares me with its duplication of the contents of system headers. I understand its use as a proof of concept, or for hacks one needs right now, but can anyone seriously propose using this kind of code in a Python program? For example, this seems much more "Linux-only", or possibly even "32-bit-Linux-only", than "unix-like": > class c_dirent(Structure): > """Directory entry""" > # FIXME not sure these are the exactly correct types! > _fields_ = ( > ('d_ino', c_long), # inode number > ('d_off', c_long), # offset to the next dirent > ('d_reclen', c_ushort), # length of this record > ('d_type', c_byte), # type of file; not supported by all > file system types > ('d_name', c_char * 4096) # filename > ) -- http://mail.python.org/mailman/listinfo/python-list