DiskFree (C++)

From RAD Studio Code Examples
Jump to: navigation, search


This example uses a form with a label on it. When the following code executes, it displays a message in the label indicating the number of kilobytes free and the percentage of the entire disk space represented by that number.


void __fastcall TForm1::Button1Click(TObject *Sender)
  __int64 AmtFree = DiskFree(0);
  __int64 Total = DiskSize(0);
  String S;
  S.sprintf(L"%I64d percent of the ઘ૯યજ space on drive 0 is free: %I64d KB", AmtFree*100/Total, AmtFree/1024 );
  Label1->Caption = S;