A>
Program DIRECTOR;
Type Directory = Record
Number : Integer;
Entry : Array [1..50] of String [12];
End;
Var DiskA, DiskB, DiskP : Directory;
N : Integer;
Procedure Dir (Drive : Char; Var Disk : Directory);
Var Offset : Integer;
FCB : Array [0..12] of char absolute $005C;
Buffer : String [128];
Begin
FCB := #0'???????????'#0;
If Drive in ['A'..'P'] then FCB [0] := char (byte (Drive) - $40)
else if Drive in ['a'..'p'] then FCB [0] := char (byte (Drive) - $60)
else FCB [0] := #0;
Bdos (26, addr (Buffer) + 1); (* Datenpuffer festlegen *)
Offset := Bdos (17, addr (FCB)); (* den ersten Eintrag suchen *)
Mem [addr (Buffer)] := 128; (* Stringlaenge festlegen *)
Disk.Number := 0;
while Offset < 255 do
Begin
Disk.Number := Disk.Number + 1;
Disk.Entry [Disk.Number] := concat (copy (Buffer, 2 + 32 * Offset, 8),
'.', copy (Buffer, 10 + 32 * Offset, 3));
Offset := Bdos (18); (* den folgenden Eintrag suchen *)
End;
End;
Begin
ClrScr;
Dir ('a', DiskA);
Dir ('b', DiskB);
Dir ('p', DiskP);
GotoXY ( 1, 1); writeln ('Disk A:', DiskA.Number:3, ' Dateien');
For N := 1 to DiskA.Number do
Begin
GotoXY ( 1, N+2); writeln (' ', N:2, ' ', DiskA.Entry [N]);
End;
GotoXY (30, 1); writeln ('Disk B:', DiskB.Number:3, ' Dateien');
For N := 1 to DiskB.Number do
Begin
GotoXY (30, N+2); writeln (' ', N:2, ' ', DiskB.Entry [N]);
End;
GotoXY (60, 1); writeln ('Disk P:', DiskP.Number:3, ' Dateien');
For N := 1 to DiskP.Number do
Begin
GotoXY (60, N+2); writeln (' ', N:2, ' ', DiskP.Entry [N]);
End;
GotoXY (1,23);
End.
Das Disketten-Inhaltsverzeichnis liefert diese Turbo-Pascal-Prozedur
[Pascal source]