home *** CD-ROM | disk | FTP | other *** search
- {$C-}
- Program CONVERT ( Input, Output );
-
- Type
- AnyString = String [ 12 ];
- Name = String [ 12 ];
- Str12 = String [ 12 ];
- Rec = Record
- Line : String [ 80 ];
- End;
-
- VAR
- A, G, End_Of_File : Integer;
- OK : Boolean;
- Line : String [ 80 ];
- Text_File : Text [ $1000 ];
- Random_File : File of Rec;
- Random_Line : Rec;
- Input, Output : String [ 12 ];
-
- Procedure Initialize_Variables;
- Begin
- A := 0;
- G := 0;
- End;
-
- Function StUpCase ( St : AnyString ) : AnyString;
- Var I : Integer;
- Begin
- For I := 1 to Length ( St ) do
- St [ I ] := UpCase ( St [ I ] );
- StUpCase := St
- End;
-
- Procedure Stop ( FileVar : Str12 );
- Begin
- ClrScr;
- WriteLN ( ^G, StUpCase ( FileVar ), ' not found.' );
- Halt;
- End;
-
- Procedure Convert ( Input, Output : Str12 );
- Begin
- Write ( 'Opening Files...' );
- Reset ( Text_File );
- Assign ( Random_File, Output );
- ReWrite ( Random_File );
- Write ( 'Converting...' );
- With Random_Line do
- Begin
- While Not Eof ( Text_File ) do
- Begin
- Line := ' ';
- ReadLN ( Text_File, Line );
- Write ( Random_File, Random_Line );
- End;
- End;
- { Reset ( Random_File );
- With Random_Line do
- Begin
- While Not Eof ( Random_File ) do
- Begin
- A := A + 1;
- Seek ( Random_File, A );
- Read ( Random_File, Random_Line );
- WriteLN ( Line );
- End;
- End; }
- Write ( 'Closing Files...' );
- Close ( Text_File );
- Close ( Random_File );
- Write ( 'Done.' );
- End;
-
- Procedure Ask_Names;
- Begin
- ClrScr;
- WriteLN ( 'Program to convert a TEXT file into a RANDOM file (field length 80)' );
- WriteLN ( 'that can be read by TURBO. By Jon Bauer: (203)-281-7287 *DATA*' );
- WriteLN;
- Write ( 'Input (TEXT) file name: ' );
- BufLen := 12;
- ReadLN ( Input );
- If ( Input = '' ) Then Ask_Names;
- Assign ( Text_File, Input );
- {$I-}
- Reset ( Text_File );
- {$I+};
- OK := (IOresult = 0 );
- If Not OK Then Stop ( Input );
- Write ( 'Output (RANDOM) file name: ' );
- BufLen := 12;
- ReadLN ( Output );
- If ( Output = '' ) Then Ask_Names;
- End;
-
- Begin
- Initialize_Variables;
- Ask_Names;
- Convert ( Input, Output );
- End.