Because I have no idea how to do this properly (It has been a hundred
years since I last used this form of file IO in Pascal) I have done
the following hack, just to get it running somehow but now I wonder
what would be the proper way to do this. How can I do something like a
hypothetical IsOpen(StdOut) the proper way? This is what I have done
but I don't like it:

implementation
var
  HasOutput: Boolean = True;

procedure log(const s: String);
begin
  if HasOutput then
    writeln(s);
end;

initialization
  try
    writeln();
  except
    HasOutput := False;
  end;
end.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to