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

Declaration : abswrite()

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

Remarks:

  1. abswrite uses DOS interrupt 0×26 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.

Parameters

Parameter
What It Is/Does ?
drive
Drive number to read (or write): 0 = A1 = Betc.
nsects
Number of sectors to read (or write)
lsect
Beginning logical sector number
buffer
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.