filestream还没创建,为啥不是nil?这样的话怎么判断filestream是否已经创建呢?
var
  s:tfilestream;
begin
  if s<>nil then
  showmessage('ok');
end;

解决方案 »

  1.   

    你自己先清空,然后再判断即可s := nil;//做其他事情,比如初始化sif s <> nil then
    就可以了
      

  2.   

    我在循环里创建的filestream,在退出循环时需要判断filestream是否创建了,以便释放资源,换句话说,我也不知道filestream创建了没,现在需要判断,有什么办法吗?
      

  3.   

    var P: Pointer;begin
      P := nil;
      if Assigned (P) then Writeln ('You won''t see this');
      GetMem(P, 1024); {P valid}
      FreeMem(P, 1024); {P no longer valid and still not nil}
      if Assigned (P) then Writeln ('You''ll see this');
    end;