regading detection of stdin
Hugo Florentino
hugo at acdam.cu
Sat Dec 7 18:10:51 PST 2013
On Sat, 07 Dec 2013 21:33:56 +0100, Adam D. Ruppe wrote:
>
> Sounds like what you need is to see if stdin is a tty.
>
> import core.sys.posix.unistd; // has isatty()
>
> void main() {
> import std.stdio;
> writeln(isatty(0)); // 0 is stdin, so this will show 1 if
> keyboard or 0 if pope
> }
Interesting, thanks for pointing that (this function is not described
at all in the source code)
Now, would that work regardless of the terminal number ther user is in
(ie tty1, tty2...)?
Also, is there a way to do accomplish the same in Windows? I would
prefer my application to support both platforms if possible (unless this
posix unit is cross-platform, which seems unlikely).
More information about the Digitalmars-d-learn
mailing list