Jump to content
Fórum Script Brasil
  • 0

(Resolvido) acessar arquivo de texto


jeffersom

Question

estou tentando carregar um arquivo usando o Memo1.Lines.LoadFromFile('C:\....'); .É um arquivo que está sendo utilizado por outro programa, então o delphi retorna o seguinte erro:

"Cannot open File "C:\endereço_do_arquivo". O arquivo já está sendo usado por outro processo.

Esse mesmo arquivo pode ser aberto usando o notepad++ mesmo estando em uso pelo processo original.

Quando abro o arquivo usando o reset e tento ler os dados pelo read o delphi retorna o erro I/O ERROR 32.

Como posso fazer para ler os dados desse arquivo enquanto ele está sendo utilizado pelo processo original?

É um arquivo de log....

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0
Quando abro o arquivo usando o reset e tento ler os dados pelo read o delphi retorna o erro I/O ERROR 32.

É um arquivo de log....

var f:TextFile; Linha:String;
begin
 AssignFile(f, 'Caminho do Arquivo.txt');
 Reset(f);
 While not Eof(f) do
   Readln(f, Linha);
 CloseFile(f);
end;
quando voce quer ler um arquivo que esta sendo usado por outro programa, voce só poderá fazer isso se for somente para leitura. o comando Reset vai fechar e abrir o arquivo em modo exclusivo ( para leitura e escrita ) por isso acontece o erro: I/O ERROR 32. Ao tentar carregar o arquivo pelo Memo tambem não é possivel
memo1.lines.LoadFromFile( 'c:\dirname\filename.txt');
"Cannot open File "C:\endereço_do_arquivo". O arquivo já está sendo usado por outro processo. Uma solução possivel seria, tentar abrir o arquivo mudando o seu atributo para somente leitura
var f:TextFile; Linha:String;
begin
 AssignFile(f, 'Caminho do Arquivo.txt');
 FileMode := fmOpenRead or fmShareDenyNone; //  atributo do arquivo
 Reset(f);
 While not Eof(f) do
   Readln(f, Linha);
 CloseFile(f);
end;
outro exemplo
var f: textfile;
   s: string;
   xx: integer;
begin
   getregistryvalue; 
   Assignfile(F, 'Caminho do Arquivo.log'); 
   FileMode := fmOpenRead or fmShareDenyNone;
   reset(F); 
   repeat
      ReadLn(F, S); 
      if (Pos('test', S) <> 0) then xx :=xx+1; 
   until EOF(F);
   Closefile(F);
   label1.caption:=inttostr(xx); 
end;

abraço

Link to comment
Share on other sites

  • 0

Quero fazer um aplicativo para Monitoração de dados, onde eu possa capturar dados exibidos por um software e salvar em um arquivo TXT para que eu possa manipular esse dados depois.

Funcionaria da seguinte forma: O programa capturia os dados como como da imagem abaixo (que mudam o tempo todo), por meio do arquivo de log do software de terceiro ou pela identificação de caracteres (como se fosse identificar um anti-chapcha eu imagino). Ou de alguma outra forma que eu ainda não tenha pensado.

Imagem de exemplo

Link to comment
Share on other sites

  • 0

É essa informação que voce quer ler pelo delphi ?

[2011/11/08 18:57:55]VC++ __active_heap = 1

HeapQueryInformation=2

GetProcessAffinityMask=0x00000001

tryLock supported

PID=2588

[2011/11/08 18:57:56]

C:\Arquivos de programas\PokerStars\PokerStars.exe --update

register pokerstars url handler success

========= OS NT 5.1 'Service Pack 2' Client 5.138 Oct 31 2011

setting locale to 28...

loaded 129688 localized messages

... using communicator ...

CommThreadManager: Unknown option 'tcpconnect' - ignored

CommThreadManager: Unknown option 'threadpriority' - ignored

[2011/11/08 18:57:57]

Started Local thread #0 - type 'replay'

Sending CREATESERVER msg to local thread #0

LocalThread[ 0 ]: Creating Server 'replayInstance'

CommLMAcceptThread: create accepting communication point (pyr_5543)

Shared memory create accept pyr_5543:

HandReplayServer v1.0.0.0, protocol v0.1.32

layout on all monitors

layout management disabled

Auto-rebuy 0 (0,0 - 0,0)

Auto-rebuy 1 (0,0 - 0,0)

CommRoutingTable: server object 'replayInstance' registered

GUID 0D77760403050D060D0D710577010D01/

SYSVOL 48095D6C

MAC 00502C04C415

MAC 00502C04C415

LocalThread[ 0 ]: ServerObject 'replayInstance' created in slot 0

LocalThread[ 0 ]: ServerObject( 0 ) registered

CommServerConnectionPool: _COMM_MSGTYPE_PHYSICAL_CONNECT

soundOn

Loading sound file 'C:\Arquivos de programas\PokerStars\Snd\snd0.wav'...

format: 1, align: 2, bits: 16

Loading sound file 'C:\Arquivos de programas\PokerStars\Snd\snd1.wav'...

format: 1, align: 1, bits: 8

Loading sound file 'C:\Arquivos de programas\PokerStars\Snd\snd2.wav'...

format: 1, align: 2, bits: 16

Loading sound file 'C:\Arquivos de programas\PokerStars\Snd\snd3.wav'...

format: 1, align: 2, bits: 16

Loading sound file 'C:\Arquivos de programas\PokerStars\Snd\snd4.wav'...

format: 1, align: 1, bits: 8

Loading sound file 'C:\Arquivos de programas\PokerStars\Snd\snd5.wav'...

format: 1, align: 1, bits: 8

Loading sound file 'C:\Arquivos de programas\PokerStars\Snd\snd6.wav'...

format: 1, align: 2, bits: 16

Loading sound file 'C:\Arquivos de programas\PokerStars\Snd\snd7.wav'...

format: 1, align: 1, bits: 8

Loading sound file 'C:\Arquivos de programas\PokerStars\Snd\snd12.wav'...

format: 1, align: 1, bits: 8

CommIdMap: 1/2 capacity limit exceeded - rehashing

CommIdMap: rehash completed

CommIdMap: 1/2 capacity limit exceeded - rehashing

CommIdMap: rehash completed

LobbyIp2CountryConnection::connect

LobbyServerConnection::connect

[2011/11/08 18:57:58]

========= GlobalMemoryStatus =========

MemoryLoad 28

TotalPhys 3FF7C000, AvailPhys 2E09A000, TotalVirtual 7FFE0000, AvailVirtual 7C77F000, TotalPageFile 99E2B000, AvailPageFile 8A9FE000

GDI objects 41, USER objects 133

CommClientSubscriberPool: _COMM_MSGTYPE_PHYSICAL_CONNECT

Started RW thread #0

Socket pushed to thread #0

CommClientConnectionPool: _COMM_MSGTYPE_PHYSICAL_CONNECT

Shared memoroy create: sslp0000067c000bc67d

[2011/11/08 18:57:59]

LobbyReportConnection::connect

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F510C peerId=E65F4C01

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F510D peerId=E65F4C02

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F510E peerId=E65F4C03

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F510F peerId=E65F4C04

CommClientConnectionPool: _COMM_MSGTYPE_CONNECT_REQUEST_ACCEPTED: thisId=E65F5003 peerId=E65F4C01

CommClientConnectionPool: _COMM_MSGTYPE_CONNECT_REQUEST_ACCEPTED: thisId=E65F5004 peerId=E65F4C02

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F5110 peerId=E65F4C05

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F5111 peerId=E65F4C06

CommClientConnectionPool: _COMM_MSGTYPE_CONNECT_REQUEST_ACCEPTED: thisId=E65F5005 peerId=E65F4C03

CommRWThreadProcess[ 0 ]: Socket placed to slot #0

[2011/11/08 18:58:57]

CommRWThreadProcess[ 0 ]: slot #0 failed to connect: Couldn't connect: Unknown error (0=0x0)

Exiting CommRWThreadProcess[ 0 ]

forceDisconnectSharedMem sslp0000067c000bc67d - after lock(): readBlock = 0, sharedAddres=02D80000

clearEverything sslp0000067c000bc67d

[2011/11/08 18:58:58]

Started RW thread #0

Socket pushed to thread #0

Shared memoroy create: sslp00000794000cb210

CommRWThreadProcess[ 0 ]: Socket placed to slot #0

[2011/11/08 18:59:08]

CommRWThreadProcess[ 0 ] - connected: addr= 77.87.178.72, slot=0, remote slot=1

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F510C peerId=E65F4C01 priority=6 size=13614

CommClientConnectionPool: _COMM_MSGTYPE_CONNECT_REQUEST_GRANTED: thisId=E65F5003 peerId=E65F4C01 priority=6

CommClientConnectionPool: _COMM_MSGTYPE_CONNECT_REQUEST_GRANTED: thisId=E65F5004 peerId=E65F4C02 priority=6

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F510D peerId=E65F4C02 priority=6 size=269

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F510E peerId=E65F4C03 priority=6 size=498

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F510F peerId=E65F4C04 priority=6 size=7154

LobbyFrame::OnRootSynchr() SrvTime 2011/11/08 15:58:46

LobbyFrame::LobbyClientConnection::OnClosed

size of global image cache 0, size of 2 local image caches 0

CommClientConnectionPool: _COMM_MSGTYPE_CONNECT_REQUEST_GRANTED: thisId=E65F5005 peerId=E65F4C03 priority=6

LobbyIcpServerConnection::connect

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F5112 peerId=E65F4C07

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F5113 peerId=E65F4C08

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F5114 peerId=E65F4C09

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F5115 peerId=E65F4C0A

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F5116 peerId=E65F4C0B

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F5117 peerId=E65F4C0C

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F5118 peerId=E65F4C0D

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F5119 peerId=E65F4C0E

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F511A peerId=E65F4C0F

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F511B peerId=E65F4C10

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F511C peerId=E65F4C11

CommClientConnectionPool: _COMM_MSGTYPE_CONNECT_REQUEST_ACCEPTED: thisId=E65F5006 peerId=E65F4C04

[2011/11/08 18:59:09]

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F5110 peerId=E65F4C05 priority=6 size=131117

[2011/11/08 18:59:10]

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F5111 peerId=E65F4C06 priority=6 size=70

CommClientConnectionPool: _COMM_MSGTYPE_CONNECT_GUARD_REQUEST_GRANTED: thisId=E65F5003 peerId=E65F4C01 sessionId=000BC30D priority=6

CommClientConnectionPool: _COMM_MSGTYPE_CONNECT_GUARD_REQUEST_GRANTED: thisId=E65F5004 peerId=E65F4C02 sessionId=000BC303 priority=6

MSG_REDIRECTOR_URL posted

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F5112 peerId=E65F4C07 priority=6 size=29275

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F5113 peerId=E65F4C08 priority=6 size=1259

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F5114 peerId=E65F4C09 priority=6 size=1300

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F5115 peerId=E65F4C0A priority=6 size=65

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F5116 peerId=E65F4C0B priority=6 size=47

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F5117 peerId=E65F4C0C priority=6 size=47

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F5118 peerId=E65F4C0D priority=6 size=66

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F5119 peerId=E65F4C0E priority=6 size=294

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F511A peerId=E65F4C0F priority=6 size=66

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F511B peerId=E65F4C10 priority=6 size=66

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F511C peerId=E65F4C11 priority=6 size=1626

CommClientConnectionPool: _COMM_MSGTYPE_CONNECT_REQUEST_GRANTED: thisId=E65F5006 peerId=E65F4C04 priority=6

CommClientConnectionPool: _COMM_MSGTYPE_CONNECT_GUARD_REQUEST_GRANTED: thisId=E65F5005 peerId=E65F4C03 sessionId=000BCB58 priority=6

LobbyReportConnection::disconnect

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F511D peerId=E65F4C12

[2011/11/08 18:59:11]

MSG_REDIRECTOR_URL_REPLY received

LobbyIp2CountryConnection::disconnect

CommClientConnectionPool: _COMM_MSGTYPE_CONNECT_GUARD_REQUEST_GRANTED: thisId=E65F5006 peerId=E65F4C04 sessionId=000CD99D priority=4

DBM_Q_IMAGE posted

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F511D peerId=E65F4C12 priority=4 size=711

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F511E peerId=E65F4C13

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F511F peerId=E65F4C14

[2011/11/08 18:59:12]

DBM_A_IMAGE received

DBM_Q_IMAGE posted

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_FATALERROR: thisId=E65F511E peerId=E65F4C13 errCode=08 errMsg='Unknown publisher channel'

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F511F peerId=E65F4C14 priority=4 size=3397

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F5120 peerId=E65F4C15

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F5121 peerId=E65F4C16

DBM_A_IMAGE received

DBM_Q_IMAGE posted

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F5121 peerId=E65F4C16 priority=6 size=81

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F5120 peerId=E65F4C15 priority=4 size=22642

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F5122 peerId=E65F4C17

DBM_A_IMAGE received

DBM_Q_IMAGE posted

[2011/11/08 18:59:13]

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F5122 peerId=E65F4C17 priority=4 size=1605

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F5123 peerId=E65F4C18

DBM_A_IMAGE received

DBM_Q_IMAGE posted

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F5123 peerId=E65F4C18 priority=4 size=811

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F5124 peerId=E65F4C19

DBM_A_IMAGE received

DBM_Q_IMAGE posted

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F5124 peerId=E65F4C19 priority=4 size=896

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F5125 peerId=E65F4C1A

[2011/11/08 18:59:14]

DBM_A_IMAGE received

DBM_Q_IMAGE posted

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F5125 peerId=E65F4C1A priority=4 size=796

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F5126 peerId=E65F4C1B

DBM_A_IMAGE received

DBM_Q_IMAGE posted

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F5126 peerId=E65F4C1B priority=4 size=20894

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F5127 peerId=E65F4C1C

[2011/11/08 18:59:15]

DBM_A_IMAGE received

DBM_Q_IMAGE posted

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F5127 peerId=E65F4C1C priority=4 size=14308

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F5128 peerId=E65F4C1D

DBM_A_IMAGE received

DBM_Q_IMAGE posted

[2011/11/08 18:59:16]

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F5128 peerId=E65F4C1D priority=4 size=15518

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F5129 peerId=E65F4C1E

DBM_A_IMAGE received

DBM_Q_IMAGE posted

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F5129 peerId=E65F4C1E priority=4 size=20916

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F512A peerId=E65F4C1F

DBM_A_IMAGE received

LobbyIcpServerConnection::disconnect

[2011/11/08 18:59:17]

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F512A peerId=E65F4C1F priority=4 size=23614

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F512B peerId=E65F4C20

[2011/11/08 18:59:18]

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F512B peerId=E65F4C20 priority=4 size=26463

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F512C peerId=E65F4C21

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F512C peerId=E65F4C21 priority=4 size=18966

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_REQUEST_ACCEPTED: thisId=E65F512D peerId=E65F4C22

[2011/11/08 18:59:19]

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESPONSE: thisId=E65F512D peerId=E65F4C22 priority=4 size=21839

[2011/11/08 18:59:29]

CommClientSubscriberPool: unexpected _COMM_MSGTYPE_SUBSCRIPTION_ONLINE_UPDATE msg for subscrId=E65F5110 in state=5 - ignored

[2011/11/08 19:15:24]

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESYNC: thisId=E65F5110 peerId=E65F4C05 size=41615

[2011/11/08 19:15:25]

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESYNC: thisId=E65F5111 peerId=E65F4C06 size=18

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESYNC: thisId=E65F5121 peerId=E65F4C16 size=18

[2011/11/08 19:28:59]

size of global image cache 0, size of 2 local image caches 1

[2011/11/08 19:59:02]

size of global image cache 0, size of 2 local image caches 1

[2011/11/08 20:23:32]

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESYNC: thisId=E65F5110 peerId=E65F4C05 size=57212

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESYNC: thisId=E65F5111 peerId=E65F4C06 size=18

CommClientSubscriberPool: _COMM_MSGTYPE_SUBSCRIPTION_RESYNC: thisId=E65F5121 peerId=E65F4C16 size=18

Link to comment
Share on other sites

  • 0

OK.. o código abaixo irá ler esse arquivo e jogará para um Memo, mas voce terá que usar um botão ou um timer para fazer a atualização da leitura

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}


procedure TForm1.Button1Click(Sender: TObject);
var
   vFileList : TStringList;
   vFileStream : TStream;
   i : integer;
begin
   vFileList := TStringList.Create;

   try
      Memo1.Clear;
      vFileStream := TFileStream.Create('C:\Arquivos de Programas\PokerStars\PokerStars.log.0',
                                        fmShareDenyNone);
      vFileList.LoadFromStream(vFileStream);
      vFileStream.Destroy;

      for i := 1 to vFileList.Count - 1 do
        Memo1.Lines.Append(vFileList.Strings[i]);

   finally
      vFileList.Free;
   end;

end;

end.

abraço

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...