[fpc-pascal]writeln in win32 gui application

Peter Vreman peter at freepascal.org
Mon May 10 07:18:47 CEST 2004


> On 9 May 2004 at 12:17, Peter Vreman wrote:
>
>> At 11:55 9-5-2004, you wrote:
>> >Hi,
>> >
>> >The following program gives run time error 103. If I uncomment the
>> >rewrite line, it runs ok. Is this a bug or feature? If it is a feature,
>> >can somebody explain, the reasoning behind it.
>> >
>> >program guiwriteln;
>> >
>> >{$mode objfpc}{$H+}
>> >{$apptype gui}
>> >
>> >begin
>> >   //rewrite(output);
>> >   writeln('Test');
>> >end.
>>
>> When running in GUI mode the output and input files are not opened so
>> there
>> is no console window. With the rewrite(output) you explicitly open the
>> output file and force the console window.
>
> Well, that is the funny part. If I add the rewrite(output) the output file
> is opened (no crash
> and I can do writeln's), but no console window is opened either. Just the
> situation I want.
>
> Now I want to know why it isn't opened by default. The drawback of opening
> it (the
> console window) doesn't happen. The output just seems to be ignored. (Good
> thing,
> because if you want to see the output, you should compile as a console
> application.)

Compatibility with Delphi.







More information about the fpc-pascal mailing list