Problema com Transferência de dados entre arquivos

Delphi

03/02/2011

Olá estou com um problema onde ocorre erro na linhas:

readln(arq, guard);writeln(ar2, guard);

Ocorre os seguintes erros:

[Error] Unit1.pas(53): Incompatible types[Error] Unit1.pas(54): Illegal type in Write/Writeln statement[Fatal Error] Project2.dpr(5): Could not compile used unit 'Unit1.pas'


OBS: Quando tiro o ln das duas funções o código compila


[code]

...
procedure faz;vartmp : boolean;guard : byte;begin
assign(arq,'c:\arquivo.bin');reset(arq);read(arq, guard);tmp := EOF(arq);
assign(ar2, 'c:\teste.bin');rewrite(ar2);reset(ar2);write(ar2, guard);
  while(tmp <> true) dobegin
readln(arq, guard);writeln(ar2, guard);
end;
close(arq);close(ar2);
   end;


...






Agradeço se alguém puder ajudar.
Olocobixo

Olocobixo

Curtidas 0

Respostas

Efraim Santana

Efraim Santana

03/02/2011

que tipo de dados você ta tentando transmitir... se for texto você pode usar uma StringList que fica bem mais facil.



var
  strLst1, strLst2 : TStringList;
begin
  try
    strLst1 := TStringList.Create;
    strLst2 := TStringList.Create;

    strLst1.LoadFromFile('C:\Arquivo1.txt');
    strLst2.LoadFromFile('C:\Arquivo2.txt');

    //Faz as modificações no conteúdo das String List e salva os arquivos.


    strLst1.SaveToFile('C:\Arquivo1.txt');
    strLst2.SaveToFile('C:\Arquivo2.txt');
  finally
    strLst1.Free;
    strLst2.Free;
  end;
end;





se não resolver tenta da mais detalhe do problema.
GOSTEI 0
POSTAR