I get the compiler error Incompatible types: 'Byte' and 'String' on the following function:
IntToStr(DiskSize('F:\'))
I want to convert the disk size to a string. How to solve this problem?
The argument for DiskSize is a byte (hence, not a string) where 0 is current drive, 1=A, 2=B etc. so for drive F you want DiskSize(6), or more generally a function to do this would be:
function DiskSizeL(DriveLetter: Char): Int64;
begin
DriveLetter := UpCase(DriveLetter);
Result := DiskSize(1 + Ord(DriveLetter) - Ord('A'));
end;
You would want to check that the char was in the range A to Z though etc.
DiskSize. After all, if you haven't used a funcion before, you always consult the documentation before you use it, especially if you don't know how to use it, like in this case. - Andreas Rejbrand