Thursday, February 19, 2015

Learning C Functions :abswrite ( Dos Only )

C Programming :
Function : abswrite


Syntax :

#include <dos.h>
int abswrite(int drive, int nsects, long lsect, void *buffer);

Description :

abswrite writes specific disk sectors. It ignores the logical structure of a disk and pays no attention to files, FATs, or directories .
If used improperly , abswrite can overwrite files, directories, and FATs .
abswrite uses DOS interrupt 0x26 to write specific disk sectors .

drive    drive number to write to (0 = A, 1 = B, etc.)
nsects    number of sectors to write to
lsect    beginning logical sector number
buffer    memory address where the data is to be written

The number of sectors to write to is limited to 64K or the size of the buffer, whichever is smaller .

Return Value :
If it is successful, abswrite returns 0 .
On error, the routine returns -1 and sets the global variable errno to the value of the AX register returned by the system call .

No comments:

Post a Comment