home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ukma!bogus.sura.net!howland.reston.ans.net!usc!srhqla!quest!kdq
- From: kdq@quest.UUCP (Kevin D. Quitt)
- Newsgroups: comp.lang.c
- Subject: Re: Turbo C FOPEN error
- Message-ID: <7Be3XB3w165w@quest.UUCP>
- Date: Wed, 27 Jan 93 18:05:41 PST
- References: <1993Jan27.053643.21953@news.cs.brandeis.edu>
- Reply-To: srhqla!quest!kdq
- Organization: Job quest (805) 251-8210, So Cal: (800) 400-8210
- Lines: 25
-
- gilmour@binah.cc.brandeis.edu (Jeffrey R. Gilmour) writes:
- > I can't figure out what's wrong. This program works fine as long as there's
- > less than 16 files (it doesn't actually matter what drive). I haven't come
- > across anything explaining it in the manual. The error happens at runtime
- > during the 'stream = fopen(name...' line. Anybody?
- ...
- > done = _dos_findfirst("a:*.*", _A_NORMAL, &test);
- > while (!done) {
- ...
- > if ((stream = fopen(name, "r")) == NULL) {
- ...
- > }
- >
- > done = _dos_findnext(&test);
- > }
- > fclose(stream);
- > }
-
- Real easy - you're running out of file descriptors since you
- never close the files you're opening. Move the fclose to just above
- the _dos_findnext and your problem will disappear.
-
-
- _
- Kevin D. Quitt 96.37% of all statistics are made up. srhqla!quest!kdq
-