Table of Content

C abswrite() function : C Reference

Abswrite() : Write absolute disk sectors in C [dos.h function]

Declaration : abswrite()

int abswrite(int drive,int nsects,long lsect,void *buffer);


  1. abswrite uses DOS interrupt 0x26 to read specific disk sectors.
  2. abswrite writes absolute disk sectors
  3. It ignores the logical structure of a disk and pay no attention to files, FATs, or directories.
  4. The number of sectors to read  is limited to 64K or the size of the buffer, whichever is smaller.
  5. If used improperly, abswrite can overwrite files, directories, and FATs.


What It Is/Does ?
Drive number to read (or write): 0 = A 1 = B etc.
Number of sectors to read (or write)
Beginning logical sector number
Memory address where the data is to be read (or written)

Return Value:

  1. On success, return 0.
  2. On error, return -1 and set errno to the value of the AX register returned by the system call.