home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
lan
/
g0bsx
/
round.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-05-03
|
1KB
|
64 lines
program round ;
const linelen = 80;
cr = #$0D;
sp = #$20;
lf = #$0A;
type pathname = string[80];
workstring = string[128] ;
var sppos, pos : integer;
c,lc : char ;
fi,fo : text ;
line, tline : workstring ;
{$I \pascal\fopen.inc }
begin
if paramcount < 2 then begin
writeln('*** Round: Not enough parameters');
halt
end;
if not fopen(fi, paramstr(1), 'r') then begin
writeln('*** Error in opening ', paramstr(1));
halt
end;
if not fopen(fo, paramstr(2), 'w') then begin
writeln('*** Error in opening ', paramstr(2));
halt
end;
pos := linelen-15;
line := '';
tline := '';
lc := cr;
while not eof(fi) do begin
read(fi,c);
if c <> lf then begin
if (c = sp) and (lc <> sp) then pos := length(line);
if (c = cr) then begin
writeln(fo,line);
pos := linelen-15;
line := ''
end
else begin
line := line + c;
if (length(line) >= linelen) then begin
if pos < length(line) then begin
tline := copy( line, pos+1, length(line));
line := copy (line, 1, pos)
end else
tline := '';
pos := linelen-15;
writeln(fo,line);
line := tline;
while (line[1] = sp) and (length(line)>0) do
line := copy( line,2,length(line))
end
end
end
end;
close(fo);
close(fi)
end.