critical error handling - Thanks!

new topic     » goto parent     » topic index » view thread      » older message » newer message

Lee woo seob wrote:
>Dear Craig Gilbert,

>Thanks much for your answers! your codes for checking "write
>protected status" is the exact one that i wanted.

>Bye! -- from Lee woo seob...

>p.s. If you have any plan to upgrade your routine in future, i
>think it might be good that you add the routine of "getting disk
>free space", since insufficient disk space for writing operation
>may also cause critical error. =


Maybe this is what you're searching for:

include machine.e
include wildcard.e

global function dskspace(integer drive_num)
-- returns the number of available bytes on a disk, 0 if drive not
recognized
-- drive_num 0 is the default, 1 is a, etc...
sequence reg_list
    reg_list =3D repeat(0, 10)
    reg_list[REG_AX] =3D #3600        -- call DOS function 36H
    reg_list[REG_DX] =3D drive_num
    reg_list =3D dos_interrupt(#21, reg_list)
    -- BX: available clusters; CX: bytes per cluster; AX: sectors per
cluster
    -- Note: DX * CX * AX gives the total number of bytes on the disk
    return reg_list[REG_BX] * reg_list[REG_CX] * reg_list[REG_AX]
end function    -- dskspace

? dskspace(0)

bye,

Ad_Rienks at compuserve.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu