Check output device is a terminal: Difference between revisions
Content added Content deleted
imported>Regattaguru |
(Initial FutureBasic submission for Editing Check output device is a terminal) |
||
Line 244: | Line 244: | ||
Sleep |
Sleep |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
=={{header|FutureBasic}}== |
|||
<syntaxhighlight lang="futurebasic"> |
|||
include "NSLog.incl" |
|||
local fn IsOutputDeviceTerminal as BOOL |
|||
int fileDescriptor |
|||
cln fileDescriptor = fileno( stdout ); |
|||
end fn = fn isatty( fileDescriptor ) != 0 |
|||
BOOL isTerminal : isTerminal = fn IsOutputDeviceTerminal |
|||
if (isTerminal) |
|||
NSLog( @"Output is directed to a terminal." ) |
|||
else |
|||
NSLog( @"Output is not directed to a terminal." ) |
|||
end if |
|||
HandleEvents |
|||
</syntaxhighlight> |
|||
=={{header|Go}}== |
=={{header|Go}}== |
||
Tells a ''terminal'' apart from a ''pipe'' on Linux and Mac, which is probably exactly what you need. |
Tells a ''terminal'' apart from a ''pipe'' on Linux and Mac, which is probably exactly what you need. |