reset() regression

Frank Heckenbach frank at
Mon May 21 22:45:46 CEST 2001

Ian Thurlbeck wrote:

> I've just noticed a small difference with the gpc-20010512 compiler from the
> one I was using (gpc-19991030).  If you do:
> program restest(input,output);
> var s:string(40);
>     t:text;
> begin
> 	s:="";
> 	{$i-}
> 	reset(t,s);
> 	if (IOResult = 0) then
> 		writeln('File exists')
> 	else
> 		writeln('File does not exist');
> end.
> the 1999 compiled code produces "File does not exist" whilst the
> 2001 code produces "File exists". Not sure if you consider this worth
> fixing given I can test for "" before I do the reset() easily enough.
> ( A "" filename is produced by some legacy code I maintain, when someone
> presses RETURN to a filename: prompt.  Not very sensible to go passing it to 
> reset(), but there you go. )

It's BP compatibility feature. An empty file name stands for stdin
(Reset) or stdout (Rewrite). If it's really annoying you, one could
thing about making it optional, but this would be some work. It's
probably easier to handle it in user code.

BTW, if you only want to check whether a file exists, you can just
use the function FileExists. (From the snippet above, I don't know
if you're doing anything else with the file, or only testing whether
it exists.)


Frank Heckenbach, frank at,
GPC To-Do list, latest features, fixed bugs:

More information about the Gpc mailing list