home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / c / 20275 < prev    next >
Encoding:
Text File  |  1993-01-28  |  2.1 KB  |  58 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!ftpbox!news.acns.nwu.edu!zaphod.mps.ohio-state.edu!darwin.sura.net!newsserver.jvnc.net!yale.edu!qt.cs.utexas.edu!news.Brown.EDU!noc.near.net!news.cs.brandeis.edu!binah.cc.brandeis.edu!GILMOUR
  3. From: gilmour@binah.cc.brandeis.edu (Jeffrey R. Gilmour)
  4. Subject: Turbo C FOPEN error
  5. Message-ID: <1993Jan27.053643.21953@news.cs.brandeis.edu>
  6. Sender: news@news.cs.brandeis.edu (USENET News System)
  7. Reply-To: gilmour@binah.cc.brandeis.edu
  8. Organization: Brandeis University
  9. Date: Wed, 27 Jan 1993 05:36:43 GMT
  10. Lines: 46
  11.  
  12. I can't figure out what's wrong.  This program works fine as long as there's
  13. less than 16 files (it doesn't actually matter what drive).  I haven't come
  14. across anything explaining it in the manual.  The error happens at runtime 
  15. during the 'stream = fopen(name...' line.  Anybody?
  16.  
  17. /*
  18. **      FOPENERR.C
  19. */
  20.  
  21. #include "stdio.h"
  22. #include "io.h"
  23. #include "dos.h"
  24.  
  25. void main(void)
  26. {
  27.         int done;
  28.         char name[15];
  29.         struct find_t test;
  30.         struct ftime ft;
  31.         FILE *stream;
  32.  
  33.         done = _dos_findfirst("a:*.*", _A_NORMAL, &test);
  34.         while (!done) {
  35.                 strcpy(name, "a:");
  36.                 strcat(name, test.name);
  37.                 if ((stream = fopen(name, "r")) == NULL) {
  38.                         printf("Error in opening filename.\n");
  39.                         exit (1);
  40.                 }
  41.  
  42.                 getftime(fileno(stream), &ft);
  43.                 printf("%-16s%7lu\t%2u/%02u/%u\n", name,
  44.                         test.size, ft.ft_month,
  45.                         ft.ft_day, ft.ft_year+1980);
  46.                 done = _dos_findnext(&test);
  47.         }
  48.         fclose(stream);
  49. }
  50.  
  51. ___________________________________ 
  52. |__/~~~~~\__/~~~~\__/~~~~\__/~~~~\_|/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  53. |____/~\____/~\_____/~\_____/~\____|\                                          /
  54. |____/~\____/~~~\___/~~~\___/~~~\__|/   T h i s   S p a c e   f o r   R e n t  \
  55. |____/~\____/~\_____/~\_____/~\____|\                                          /
  56. |__/~~~\____/~~~~\__/~\_____/~\____|/       GILMOUR@BINAH.CC.BRANDEIS.EDU      \
  57. |__________________________________|\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  58.