[Lazarus] Getting eof from standard input

Sven Barth pascaldragon at googlemail.com
Sat Dec 15 22:18:04 CET 2012


On 15.12.2012 18:50, Mark Morgan Lloyd wrote:
> I've got a program here which works fine on Linux but has started to
> fail on Windows after running fine for years. This doesn't appear to
> depend on the version of Lazarus, version of FPC or version of Windows,
> but since I've now got the source in local svn I can see that the
> earliest version I checked in (r1) works while the next one (r2) doesn't.
[...]
>
> This used to work, but what I'm now seeing is that when running on
> Windows it hangs at that Eof() until it sees ^Z<cr>
>

You *could* try to set CtrlZMarksEof to False (which is set to True for 
Windows), but I don't know whether that will really help you...

> Alternatively, does Windows have anything equivalent to IsATTY() or
> Do_IsDevice() that I could use as a guard around the failing Eof()?
>

There is no IsATTY function for Windows, but a Do_IsDevice exists 
(internal to the RTL) which basically checks whether the handle stored 
in the file rec is one of the three I/O handles (StdInputHandle, 
StdOutputHandle or StdErrorHandle).

Regards,
Sven




More information about the Lazarus mailing list