home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2140 / msdos.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-28  |  1.3 KB  |  62 lines

  1. /*
  2. **    M S - D O S   d i s k e t t e   f i l e s y s t e m
  3. */
  4.  
  5.     /* Default (implicitly assumed) sector size */
  6. #define    SECTORSIZE    512
  7.  
  8.     /*
  9.     ** FAT entries are based at 2, since the first two entries in
  10.     ** the FAT table are reserved for the ancient media descriptor byte
  11.     */
  12. #define    CLUSTER_TO_SECTOR(cluster)    (((cluster)-2)*sectors_per_cluster + \
  13.                         file_area)
  14.  
  15.     /* Some basically stdio.h constants that we define just in case */
  16. #ifndef    NULL
  17. #define    NULL    ((void *)0)
  18. #endif
  19. #ifndef    EOF
  20. #define    EOF    (-1)
  21. #endif
  22.  
  23.     /* Debugger's aid macro */
  24. #ifdef    DEBUG
  25. #define    Db(x)    x
  26. #else
  27. #define    Db(x)
  28. #endif
  29.  
  30.     /* Directory data entry format */
  31. typedef struct    {
  32.     unsigned char filename[11],attribute;
  33.     char reserved[10];
  34.     unsigned int time,date;
  35.     unsigned int cluster;
  36.     unsigned long int filesize;
  37. } directory;
  38.  
  39. #define    ATTR_READONLY    0x01
  40. #define    ATTR_HIDDEN    0x02
  41. #define    ATTR_SYSTEM    0x04
  42. #define    ATTR_VOLABEL    0x08
  43. #define    ATTR_DIRECTORY    0x10
  44. #define    ATTR_ARCHIVE    0x20
  45. #define    ATTR_UNUSED1    0x40
  46. #define    ATTR_UNUSED2    0x80
  47.  
  48. #define    ATTR_SPECIAL    0x1E
  49.  
  50.     /* Function call prototypes */
  51. void disk_open();
  52. directory *find_dir(char *filename);
  53.  
  54. int file_open(directory *dir_item);
  55. int file_getc();
  56.  
  57. directory *file_create(char *filename);
  58. int file_putc(directory *dir_item,int character);
  59. void file_close(directory *dir_item);
  60.  
  61. void disk_clear(int disktype);
  62.