hola
aquí te dejo otra solución que te puede funcionar
Código Delphi
[-]
procedure loadFileContent(const AFileName:String);
var
text: TStreamReader;
slinea: string;
begin
try
text := TStreamReader.Create(AFileName, TEncoding.Default, true);
while not text.EndOfStream do begin
slinea := text.ReadLine;
ProcesarLinea(slinea);
end;
finally
text.Free;
end;
end;
var
FileName: string;
begin
FileName := 'c:\tmp\BueCont_TXT.txt';
loadFileContent(FileName);
end;
y si lo que quieres es separar los campos incluidos dentro del propio fichero puedes hacerlo de una forma relativamente fácil de esta manera:
Código Delphi
[-]
var
parser: TStringList;
procedure ProcesarLinea(const ALinea: string);
var
Ruc, nombre, razon, fecha, resolucion: string;
begin
parser.DelimitedText := '"' + ALinea.Replace('"', '""').Replace('|', '"|"') + '"';
if parser.Count >= 5 then begin
Ruc := parser.Strings[0];
nombre := parser.Strings[1];
razon := parser.Strings[2];
fecha := parser.Strings[3];
resolucion := parser.Strings[4];
end;
Memo1.Lines.Add(Ruc + #9 + nombre + #9 + razon + #9 + fecha + #9 + resolucion);
end;
var
FileName: string;
begin
try
parser := TStringList.Create;
parser.StrictDelimiter := True;
parser.Delimiter := '|';
FileName := 'c:\tmp\BueCont_TXT.txt';
loadFileContent(FileName);
finally
parser.Free;
end;
end;
saludos