home *** CD-ROM | disk | FTP | other *** search
- program mdp1;
-
- {Program to accompany article in issue #10 of the Pascal NewsLetter. }
- {Author: Mitch Davis, (3:634/384.6) +61-3-890-2062. }
-
- {Reads up to 100 lines from a file specified on the command line. Note this}
- {program works by actually reading in the data from the file into a fixed- }
- {size array. }
-
- const MaxLines = 100;
-
- var line:array [1..MaxLines] of string; { This takes 25600 bytes }
- LineCount,Loop:word;
- f:text;
-
- begin
- writeln ('Reading...');
- assign (f,paramstr (1));
- reset (f);
- LineCount := 0;
- while not (eof (f) or (LineCount = MaxLines)) do begin
- inc (LineCount);
- readln (f,line [LineCount]);
- end;
- close (f);
- writeln;
-
- writeln ('Forward:');
- for loop := 1 to LineCount do writeln (loop:3,':',line [loop]);
- writeln;
-
- writeln ('Backwards:');
- for loop := LineCount downto 1 do writeln (loop:3,':',line [loop]);
- writeln ('Done!');
- end.
-