home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-387-Vol-3of3.iso
/
f
/
fbi92-11.zip
/
FIXFBI.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1990-02-09
|
3KB
|
110 lines
program fixfbi( input, output);
uses CRT;
const space = ' ';
var v1,v2,response: char;
source, destination : string[ 30 ];
match : boolean;
lineknt : integer;
have_read, have_written : longint;
rawdata, asciidata : text;
begin
clrscr;
gotoxy( 8, 10 );
writeln( 'Enter the path + name of the file to be converted below:');
gotoxy( 8, 11 );
write( '==> '); readln( source );
gotoxy( 8, 13 );
writeln( 'Now enter the path + name of the file to be created that');
gotoxy( 8, 14 );
writeln( 'will contain the converted text.');
gotoxy( 8, 15 );
write( '==> '); readln( destination );
gotoxy( 8, 17 );
writeln( 'SOURCE ==> ',source);
gotoxy( 8, 18 );
writeln( 'DESTINATION ==> ',destination);
response := ' ';
gotoxy( 8, 20 );
write( 'Are the above filenames correct? (y/n) ==> ');
readln( response );
if ((response = 'n') or (response = 'N' )) then exit;
assign( rawdata, source );
assign( asciidata, destination );
reset( rawdata );
rewrite( asciidata );
have_read := 0;
have_written := 0;
lineknt := 0;
clrscr;
writeln; writeln;
v1 := ' '; v2 := ' ';
while (not (eof(rawdata)) ) do
begin
read( rawdata, v1 );
inc( have_read );
match := false;
if ( (ord(v1) in [ $20..$7E ]) and
(not ((ord(v1) = $6A) and (ord(v2) = $DC)) ) ) then
begin
inc( have_written );
write( asciidata, v1 );
write( v1 );
match := true;
end;
if ( (ord(v1) = $6A) and (ord(v2) = $DC) ) then
begin
writeln( asciidata, space);
writeln( space );
inc( have_written );
inc( lineknt );
end;
if ( ord(v1) = $0D ) then
begin
inc( have_written );
writeln( asciidata, space );
writeln( space );
inc( lineknt );
match := true;
end;
if ( ord(v1) = $0A ) then
begin
inc( have_written );
writeln( asciidata, space );
writeln( space );
inc( lineknt );
match := true;
end;
if ( (match = false) and
(not (ord(v1) in [ $DC, $6A, $0, $2, $B ])) ) then
begin
write( asciidata, space );
inc( have_written );
end;
v2 := v1;
end;
writeln; writeln;
writeln( asciidata, space );
close( rawdata );
close( asciidata );
writeln( ' Summary Report' );
writeln( ' **************' );
writeln( 'Characters read from source file => ',have_read );
writeln( 'Characters written to destination file => ',have_written );
writeln( 'Total lines in destination file => ',lineknt );
writeln;
writeln;
end.