home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / c / 20268 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  1.3 KB

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