Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.lang.c Subject: Re: get the file directory Keywords: directory Message-ID: <1989Nov15.142807.3724@virtech.uucp> Date: 15 Nov 89 14:28:07 GMT References: <1724@unccvax.UUCP> Distribution: usa Organization: Virtual Technologies Inc. Lines: 25 In article <1724@unccvax.UUCP>, cs00wsc@unccvax.UUCP (Shiang Chin) writes: > I am trying to the file list of a file directory on > Sun station running Unix. Can someone read the following > C code for me; I don't know what's wrong on my code. > [ example of reading fixed length directory entries deleted ] > If anyone knows the problem, please tell me how to solve this. > Thanks a lot. The problem is that Sun uses a BSD style directory that does not have fixed length directory entries. You should use the opendir(), readdir(), etc library calls to process the directory entries. Doug gwyn posted a portable version of these directory utilities (that work for both system V and BSD file systems) to comp.sources.unix (I think). You can either use the standard BSD functions that are included in the sun libc or you can download the portable versions. -- +-----------------------------------------------------------------------+ | Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 ! | Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 | +-----------------------------------------------------------------------+