Board index » delphi » strange compiler/de{*word*81} behavior in BP7

strange compiler/de{*word*81} behavior in BP7

I have asked this question twice with no acceptable answer. Please
help!

The following code worked for me for YEARS, but now fails when I run
the program with the internal de{*word*81} on (Pentium Pro 200):

assign(fn,'non_existent_file');
{$i-}reset(fn):{$i+}
if ioresult = 0 then begin
        do stuff when file exists....
end;

the program ALWAYS tell me the file exists, and opens it for input
from the keyboard if it does not exist. This is indeed a shocker! I
have rewritten important code using filefirst to get around this, but
I'm lost as to what's happening (I even reinstalled the compiler, to
no avail). BTW, this only occurs when I am in the IDE. BP works
normally with the standalone de{*word*81} or when the program is run from
the command line. It also works correctly from native MSDOS mode--just
not in a DOS box.

I am even willing to pay Borland to help me with this. Does anyone
know the number to call.

Thanks

Sincerely,
Herbert Gintis
Professor of Economics
Herbert Gintis
Department of Economics           Phone: 413-586-7756
University of Massachusetts       Fax:   413-586-6014
Amherst, MA 01003
gin...@econs.umass.edu            http://www-unix.oit.umass.edu/~gintis/

 

Re:strange compiler/de{*word*81} behavior in BP7


 Uh... I seem to have made a typing error below. It's "reset(fn);"
not "reset(fn):"  of course
On Wed, 20 Nov 1996 09:00:16 GMT, gin...@econs.umass.edu (Herbert M.

Quote
Gintis) wrote:
>I have asked this question twice with no acceptable answer. Please
>help!

>The following code worked for me for YEARS, but now fails when I run
>the program with the internal de{*word*81} on (Pentium Pro 200):

>assign(fn,'non_existent_file');
>{$i-}reset(fn):{$i+}
>if ioresult = 0 then begin
>    do stuff when file exists....
>end;

>the program ALWAYS tell me the file exists, and opens it for input
>from the keyboard if it does not exist. This is indeed a shocker! I
>have rewritten important code using filefirst to get around this, but
>I'm lost as to what's happening (I even reinstalled the compiler, to
>no avail). BTW, this only occurs when I am in the IDE. BP works
>normally with the standalone de{*word*81} or when the program is run from
>the command line. It also works correctly from native MSDOS mode--just
>not in a DOS box.

>I am even willing to pay Borland to help me with this. Does anyone
>know the number to call.

>Thanks

>Sincerely,
>Herbert Gintis
>Professor of Economics
>Herbert Gintis
>Department of Economics           Phone: 413-586-7756
>University of Massachusetts       Fax:   413-586-6014
>Amherst, MA 01003
>gin...@econs.umass.edu            http://www-unix.oit.umass.edu/~gintis/

Herbert Gintis
Department of Economics           Phone: 413-586-7756
University of Massachusetts       Fax:   413-586-6014
Amherst, MA 01003
gin...@econs.umass.edu            http://www-unix.oit.umass.edu/~gintis/

Re:strange compiler/de{*word*81} behavior in BP7


Quote
> >The following code worked for me for YEARS, but now fails when I run
> >the program with the internal de{*word*81} on (Pentium Pro 200):

> >assign(fn,'non_existent_file');
> >{$i-}reset(fn);{$i+}
> >if ioresult = 0 then begin
> >       do stuff when file exists....
> >end;

I have experienced simular problems when I forget to read the IOResult
after using {$I-} {$I+} previously in the program (this somehow saves
the error code for later?). Also you should check that any previous
{$I-} {$I+}s are correctly terminated. I am quite confident that you will
find the cause for this problem in the code executed before this routine.

Best Regards,
Michael Andersen

Re:strange compiler/de{*word*81} behavior in BP7


On Thu, 21 Nov 1996 17:57:43 -0800, Michael Andersen

Quote
<micha...@post3.tele.dk> wrote:
>> >The following code worked for me for YEARS, but now fails when I run
>> >the program with the internal de{*word*81} on (Pentium Pro 200):

>> >assign(fn,'non_existent_file');
>> >{$i-}reset(fn);{$i+}
>> >if ioresult = 0 then begin
>> >       do stuff when file exists....
>> >end;

>I have experienced simular problems when I forget to read the IOResult
>after using {$I-} {$I+} previously in the program (this somehow saves
>the error code for later?). Also you should check that any previous
>{$I-} {$I+}s are correctly terminated. I am quite confident that you will
>find the cause for this problem in the code executed before this routine.

>Best Regards,
>Michael Andersen

Thanks for the reply. I'm sure that's not the answer though. Here's a
complete program that doesn't work:

uses dos;

var
  s : string;
  gll : text;
begin
  readln(s);
  assign(gll,s);
  {$i-}reset(gll);{$i+}
  if ioresult = 0 then begin
    writeln('File exists!');
  end;
end
else begin
  writeln('file not found');
end;
end.

Whatever I give the filename, e.g. slobbov.rrr, the program says it
exists. But only when I'm using the ide. If I run it from the command
line, or from the external de{*word*81}, it works fine.

Rats.

Cheers,

Herb Gintis

Herbert Gintis
Department of Economics           Phone: 413-586-7756
University of Massachusetts       Fax:   413-586-6014
Amherst, MA 01003
gin...@econs.umass.edu            http://www-unix.oit.umass.edu/~gintis/

Other Threads