home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / insidetp / 1990_05 / testfcb.pas < prev   
Pascal/Delphi Source File  |  1990-04-10  |  3KB  |  96 lines

  1. PROGRAM TestFCB;
  2.  
  3. { test FCBLabel UNIT}
  4.  
  5. USES  CRT,FCBLabel;
  6.  
  7. VAR
  8.    Choice      : Byte;
  9.    Drive       : DriveType;
  10.    DiskID      : DiskIDType;
  11.    NewDiskID   : DiskIDType;
  12.  
  13. BEGIN
  14.   REPEAT {Endless loop - select option 5 to Exit}
  15.     ClrScr;
  16.     GotoXY(25,1);  WriteLn('Volume Functions');
  17.     GotoXY(25,9);  WriteLn('1) SET LABEL');
  18.     GotoXY(25,10); WriteLn('2) DELETE LABEL');
  19.     GotoXY(25,11); WriteLn('3) RENAME LABEL');
  20.     GotoXY(25,12); WriteLn('4) GET LABEL');
  21.     GotoXY(25,13); WriteLn('5) Exit');
  22.     GotoXY(20,15);
  23.     Write('Type number and press Enter > ');
  24.     ReadLn(Choice); WriteLn;
  25.     Drive := 'C';   { use drive C: as test drive }
  26.  
  27.     CASE Choice OF
  28.     1: BEGIN  {Set volume LABEL}
  29.         DiskID := GetDiskID(Drive);
  30.           IF DiskID <> '' THEN
  31.             BEGIN
  32.               WriteLn('Label not null: ',DiskID);
  33.               WriteLn('Use RENAME instead');
  34.               WriteLn('Press Enter to continue');
  35.               ReadLn
  36.             END
  37.           ELSE
  38.             BEGIN
  39.               Write('Enter new label > ');
  40.               ReadLn(DiskID);
  41.               IF NOT SetDiskID(Drive,DiskID) THEN
  42.                 BEGIN
  43.                   WriteLn('System Error');
  44.                   WriteLn
  45.                      ('Press Enter to continue');
  46.                   ReadLn
  47.                 END
  48.             END
  49.           END;
  50.      2: BEGIN {Delete Volume LABEL}
  51.           IF DeleteDiskID(Drive) THEN
  52.             WriteLn('Volume label deleted')
  53.           ELSE
  54.             WriteLn('System Error');
  55.           WriteLn('Press Enter to continue');
  56.           ReadLn
  57.         END;
  58.      3: BEGIN {Rename Volume LABEL}
  59.           DiskID := GetDiskID(Drive);
  60.           IF DiskID = '' THEN
  61.             BEGIN
  62.               WriteLn('Current label is null:');
  63.               WriteLn('Use SET option instead');
  64.               WriteLn('Press Enter to continue');
  65.               ReadLn
  66.             END
  67.           ELSE
  68.             BEGIN
  69.               Write('Enter new name of label > ');
  70.               ReadLn(NewDiskID);
  71.               IF NOT ReNameDiskID
  72.                      (Drive,DiskID,NewDiskID) THEN
  73.                 BEGIN
  74.                   WriteLn('System Error');
  75.                   WriteLn
  76.                      ('Press Enter to continue');
  77.                   ReadLn
  78.                 END
  79.             END
  80.         END;
  81.      4: BEGIN {Get Volume LABEL}
  82.           DiskID := GetDiskID(Drive);
  83.           Write('The current label is ');
  84.           IF DiskID = '' THEN
  85.             WriteLn('null')
  86.           ELSE
  87.             WriteLn(DiskID);
  88.             WriteLn('Press Enter to continue');
  89.             ReadLn
  90.         END;
  91.      5: Halt;
  92.      ELSE   { continue }
  93.     END     { case }
  94.   UNTIL FALSE
  95. END.
  96.