@TSK
I've converted your code into PortablE, in case anyone is interested:
MODULE 'dos'
PROC main()
DEF data:PTR TO infodata, lock:BPTR
lock := NIL
IF lock := Lock('your_volume_name:', ACCESS_READ)
IF data := AllocDosObject(DOS_INFODATA, NILA)
IF Info(lock, data)
Print('size = \\d MB\\n', data.numblocks !!BIGVALUE * data.bytesperblock / 1024 / 1024 !!VALUE)
Print('free = \\d MB\\n', (data.numblocks - data.numblocksused) !!BIGVALUE * data.bytesperblock / 1024 / 1024 !!VALUE)
ENDIF
FreeDosObject(DOS_INFODATA, data)
ENDIF
UnLock(lock)
ENDIF
ENDPROC
The BIGVALUE & VALUE casts are there so that it can handle sizes above 2GB.
BTW, I find this code rather nicer to read than the C equivalent, but maybe that's just me
EDIT: Added a missing FreeDosObject() call.
Edited by ChrisH on 2011/8/29 14:05:04