UNIX Free Pascal




. - 2


if n<1 then n:=Pos(',',TmpS);

Writeln(f2,Copy(TmpS,1,n));

StrBuf:=Copy(TmpS,n+1,Ord(TmpS[0])-n);

while Ord(strbuf[0])>step do

begin

if Pos(',',Strbuf)>Pos(' ',StrBuf) then

begin

Writeln(f2,Copy(StrBuf,1,Pos(',',StrBuf)));

Delete(StrBuf,1,Pos(',',StrBuf));

end

else

begin

Writeln(f2,Copy(StrBuf,1,Pos(' ',StrBuf)));

Delete(StrBuf,1,Pos(' ',StrBuf));

end

end;

end

else Writeln(f2,TmpS);

end;

Close(f1);

Close(f2);

end.

 

13.4. , : , . . 40 .

Program InTwo;

var

f1,f2,f:Text;

WidthCol:Byte;

Code:Integer;

s:string;

begin

if ParamCount<3 then

begin

Writeln('Wrong parameters');

Writeln('Format: ./2 <file1> <file2> <file3> n');

Writeln('<file1> - input file');

Writeln('<file2> - first output file');

Writeln('<file3> - first output file');

Writeln('n - number of column in first file');

Halt(1);

end;

if ParamCount<4 then WidthCol:=40

else Val(Paramstr(4),WidthCol,Code);

assign(f,ParamStr(1));

reset(f);

assign(f1,ParamStr(2));

rewrite(f1);

assign(f2,ParamStr(3));

rewrite(f2);

While Not(Eof(f)) do

begin

Readln(f,s);

if Ord(s[0])>WidthCol then

begin

Writeln(f1,Copy(s,1,WidthCol));

Writeln(f2,Copy(s,WidthCol+1,Ord(s[0])-WidthCol));

end

else

begin

Writeln(f1,s);

Writeln(f2);

end;

end;

close(f2);