Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>absread() read disk sectors</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 absread()               Read Disk Sectors

 #include   <dos.h>

 int        absread(drive,nsects,sectno,buffer);
 int        drive;                       Drive number
 int        nsects;                      Number of sectors
 int        sectno;                      Number of first logical sector
 void       *buffer;                     Buffer address

    absread() reads disk sectors with DOS interrupt 0x25; it disregards
    the logical structure of the disk, as well as files, directories, and
    file allocation tables (FATs).  'drive' is the number of the drive to
    read (0 = A, 1 = B, etc); 'nsects' is the number of sectors to read;
    'sectno' is the number of the beginning logical sector; and 'buffer'
    is the address in memory into which the data is to be read.

       Returns:     0, if successful. On error, returns -1 and sets
                    'errno' to the value returned in the AX register by
                    the DOS system call.

         Notes:     A single call can read a maximum of 64K of data.

   Portability:     MS-DOS only.

   -------------------------------- Example ---------------------------------

    The following statements read the first 9 logical sectors from the
    disk in drive A:. These would correspond to the first track on a
    normal 9-sector disk.

           #include <dos.h>                /* for absread */
           #include <errno.h>              /* for errno */

           extern char *sys_errlist[];
           char buf[9*512];

           main()
           {
               if (absread(0,9,0,buf) != 0) {
                   printf("%s\n",sys_errlist[errno]);
               else
                   printf("9 sectors read\n");

           }


See Also: abswrite()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson