Hola querida comunidad, le comento tengo 2 archivos:
Prueba.txt que su contenido es:
Y tengo otro archivo llamado paciente.txt
que su contenido es
El archivo pacientes tiene 192 KB.
Eh probado con un memo y distintos métodos para abrir el archivo, con todos estos métodos si pongo el archivo prueba, me funciona bien, pero si elijo paciente me funciona mal.
Para simplificar en un form tire varios botones con las distintos código que probé.
Código Delphi
[-]
procedure TForm1.loadfromfileClick(Sender: TObject);
begin
Memo1.Lines.LoadFromFile('Pacientes.txt');
end;
procedure TForm1.assignedfileClick(Sender: TObject);
var F: TextFile;
sLinea: String;
begin
AssignFile( F, ExtractFilePath( Application.ExeName ) + 'Pacientes.txt' );
Reset( F );
while not Eof( F ) do
begin
ReadLn( F, sLinea );
Memo1.Lines.Add( sLinea );
end;
CloseFile( F );
end;
procedure TForm1.filestreamClick(Sender: TObject);
var
F: TFileStream;
s: String;
begin
F := TFileStream.Create( ExtractFilePath( Application.ExeName ) + 'Pacientes.txt', fmOpenRead );
SetLength( s, F.Size ); F.Read( s[1], F.Size );
Memo1.Text := s;
F.Free;
end;
procedure TForm1.readbyteClick(Sender: TObject);
var F: TFileStream;
Buffer: array[0..1023] of byte;
begin
F := TFileStream.Create( ExtractFilePath( Application.ExeName ) + 'Pacientes.txt', fmOpenRead );
while F.Position < F.Size do
begin
F.Read( Buffer, 1024 );
memo1.Lines.Add(String(PCHAR(@Buffer[0])));
end;
F.Free;
end;
procedure TForm1.readhexaClick(Sender: TObject);
var F: file of byte;
i: Integer;
Buffer: array[0..1] of Byte;
begin
AssignFile( F, ExtractFilePath( Application.ExeName ) + 'Pacientes.txt' );
Reset( F );
Seek( F, 0 );
BlockRead( F, Buffer, 2 );
for i := 0 to 2 do
Memo1.Text := Memo1.Text + IntToHex( Buffer[i], 2 ) + ' ';
CloseFile( F );
end;
Subo el archivo para ver si alguien lo puede leer o sea que le muestre lo mismo que le muestra el block de nota a la hora de hacer 2 clic.
https://sites.google.com/site/vamoss...edirects=0&d=1
Desde ya muchas gracias.