home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.programmer
- Path: sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!uxa.cso.uiuc.edu!bjg28027
- From: bjg28027@uxa.cso.uiuc.edu (Skydive!)
- Subject: Better way to count files in dirs
- Message-ID: <Bs20zI.EoI@news.cso.uiuc.edu>
- Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
- Organization: University of Illinois at Urbana
- Date: Mon, 27 Jul 1992 15:42:51 GMT
- Lines: 14
-
- Hello,
-
- I'm modifying some code that I've written in C previously and would like to try
- to improve on it. Right now, in order to determine the number of files
- in a directory I am doing a system call "ls -1 | wc -l > tmp" and then opening
- the file and fscanf the number. Obviously this is a very ugly way to do
- this and I would like to improve it.
-
- Are there some functions in <dirents> library that I am missing?
-
- Thanks.
-
- bgolden@ncsa.uiuc.edu
-
-