procedure swapfile(sfile:String,tfile:String);
const
ec:char=#13;
var
sf,tf:File;
readnum,i1:integer;
///if you want rewrite source file
numwrite:integer
///////////////
fc:array[0..2047] of char
//file char;
begin
assignfile(sf,sfile);
reset(sf,1);
assignfile(tf,tfile);
rewrite(tf,1);
try
repeat
blockread(sf,fc,sizeof(fc),readnum);
if readnum>0 then begin
for i1:=0 to readnum-1 do begin
if fc[i1]=#10 then blockwrite(tf,ec,1);
blockwrite(tf,fc[i1],1);
end;
end;
until (readnum=0)or(readnum<>sizeof(fc));
finally
closefile(sf);
closefile(tf);
end;
/////if you want to rewrite source file, you can use copyfile() function or use like buttom. it's the dephi examp
assignfile(sf,tfile);
reset(sf,1);
assignfile(tf,sfile);
rewrite(tf,1);
try
repeat
blockread(sf,fc,sizeof(fc),readnum);
blockwrite(tf,fc,readnum,numwrite)
until (readnum=0) or (readnum<>numwrite);
finally
closefile(sf);
closefile(tf);
end;
////////////////
end;