[fpc-pascal] stdout refuses to be redirected

Arjan van Dijk Arjan.van.Dijk at rivm.nl
Thu Oct 9 10:27:59 CEST 2008


Hi!

The following small piece of code, with filename 'test.pas':

PROGRAM Test;
USES CRT,DOS;
VAR
  DirInfo: SEARCHREC;
BEGIN
  FINDFIRST('*.pas',ARCHIVE,DirInfo);
  WRITELN(DirInfo.Name);
END.

just gives the name of the first file with extension ".pas".
It compiles and runs fine when I call is as follows:

test.exe

Now when I try to redirect the output to a file, then that file remains
empty:

test.exe > somefile

This is the narrowed down version of my malfunctioning program.
Can someone please have a look into this? A whole lot of interesting
calculations (and my boss...) are waiting for this problem to be fixed.

I use:

Free Pascal Compiler version 2.2.2
Compiler Date      : 2008/08/03
Compiler CPU Target: i386

Another encounter with similar effects: In the original code I had a loop
with FINDNEXT searching a whole directory for datafiles to be processed.
This loop terminated after processing 1 file, whereas all files were
correctly
listed when I commented out the call to the processing subroutine.
This problem is probably related to the above capricious behaviour.

Regards,


Arjan




____________________________________________________________________________

DISCLAIMER:  http://www.rivm.nl/disclaimer.htm




More information about the fpc-pascal mailing list