home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.programmer
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!convex!convex!tchrist
- From: Tom Christiansen <tchrist@convex.COM>
- Subject: Re: Better way to count files in dirs
- Message-ID: <1992Jul27.160410.11259@news.eng.convex.com>
- Originator: tchrist@pixel.convex.com
- Sender: usenet@news.eng.convex.com (news access account)
- Nntp-Posting-Host: pixel.convex.com
- Reply-To: tchrist@convex.COM (Tom Christiansen)
- Organization: CONVEX Realtime Development, Colorado Springs, CO
- References: <Bs20zI.EoI@news.cso.uiuc.edu>
- Date: Mon, 27 Jul 1992 16:04:10 GMT
- X-Disclaimer: This message was written by a user at CONVEX Computer
- Corp. The opinions expressed are those of the user and
- not necessarily those of CONVEX.
- Lines: 19
-
- From the keyboard of bjg28027@uxa.cso.uiuc.edu (Skydive!):
- :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?
-
- RTFM readdir, opendir, etc.
-
- --tom
- --
- Tom Christiansen tchrist@convex.com convex!tchrist
- If you have ever seen the grim word "login:" on a screen, your mind
- is now a wholly-owned subsidiary of The Death Star.
- John Woods in <14105@ksr.com> of comp.unix.bsd
-