home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snip9707.zip / ABSDISKC.C < prev    next >
C/C++ Source or Header  |  1997-07-05  |  1KB  |  38 lines

  1. /* +++Date last modified: 05-Jul-1997 */
  2.  
  3. /*
  4. **  ABSDISKC.C - Functions to read and write absolute disk sectors
  5. **               (these will work with all versions of DOS 2-7).
  6. **
  7. **  Public domain code by Bob Stout
  8. **
  9. **  NOTE: These functions work by calling absdisk() from SNIPPETS file,
  10. **        ABSDISK.ASM. Each returns 0 if successful.
  11. */
  12.  
  13. #include <stddef.h>
  14. #include <dos.h>
  15. #include "snpdskio.h"
  16.  
  17. int CDECL absdisk(unsigned char  function,
  18.                    unsigned short drive,              /* 0 = A:, etc.   */
  19.                    size_t         number_of_sectors,
  20.                    size_t         starting_sector,
  21.                    void *         sector_buffer);
  22.  
  23. int AbsDiskRead(unsigned short drive,
  24.                 size_t         num_of_sectors,
  25.                 size_t         sector,
  26.                 void          *ptr)
  27. {
  28.       return absdisk(0x25, drive, num_of_sectors, (unsigned)sector, ptr);
  29. }
  30.  
  31. int AbsDiskWrite(unsigned short drive,
  32.                 size_t         num_of_sectors,
  33.                 size_t         sector,
  34.                 void *ptr)
  35. {
  36.       return absdisk(0x26, drive, num_of_sectors, (unsigned)sector, ptr);
  37. }
  38.