nil

Delphi

05/11/2003

Como faço para verificar se o meu TextFile está vazio?

if NomeTextFile = nil then ???? (não funciona)


Marcela

Marcela

Curtidas 0

Respostas

Tectaf

Tectaf

05/11/2003

Vc já tentou fazer isso:
if NomeTextFile = ´´ then

Tente utilizar somente aspas simples.

Um abraço.


GOSTEI 0
Flavioklein

Flavioklein

05/11/2003

Dê uma olhada no código abaixo ...

var
arq : textfile;
begin
assignfile(arq,´nome do arquivo´);
{$I-}
reset(arq);
{$I+}
if ioresult <> 0 then
showmessage(´não existe arquivo .... blablabla´)
else
if filesize(arq) = 0 then
showmessage(´arquivo vazio....blablabla´);
...
....
closefile(arq);
end;

Valeu!
Tchau! :D


GOSTEI 0
Beppe

Beppe

05/11/2003

Após ter sido Assign´ed para um arquivo, isto funciona:
  if TTextRec(T).Handle = 0 then 


Ataliba


GOSTEI 0
POSTAR