Check input device is a terminal: Difference between revisions

Content added Content deleted
mNo edit summary
Line 67: Line 67:
</syntaxhighlight>
</syntaxhighlight>


=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
include "NSLog.incl"

BeginCCode
if (isatty(fileno(stdin)))
NSLog( @"stdin is connected to a terminal" );
else
NSLog( @"stdin is NOT connected to a terminal" );
EndC

HandleEvents
</syntaxhighlight>
{{output}}
<pre>
stdin is NOT connected to a terminal
</pre>


=={{header|C}}==
=={{header|C}}==
Line 189: Line 172:
C:\test < in.txt
C:\test < in.txt
Input doesn't come from tty.</pre>
Input doesn't come from tty.</pre>

=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
include "NSLog.incl"

BeginCCode
if (isatty(fileno(stdin)))
NSLog( @"stdin is connected to a terminal" );
else
NSLog( @"stdin is NOT connected to a terminal" );
EndC

HandleEvents
</syntaxhighlight>
{{output}}
<pre>
stdin is NOT connected to a terminal
</pre>



=={{header|Go}}==
=={{header|Go}}==