Check output device is a terminal: Difference between revisions
Check output device is a terminal (view source)
Revision as of 11:03, 17 November 2023
, 5 months ago→{{header|Wren}}: Minor tidy
Thundergnat (talk | contribs) m (Automated syntax highlighting fixup (second round - minor fixes)) |
m (→{{header|Wren}}: Minor tidy) |
||
Line 637:
{{trans|C}}
As there is currently no way to obtain this information via Wren CLI, we instead embed a Wren script in a C application and ask the host program to get it for us.
<syntaxhighlight lang="
class C {
Line 711:
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
Line 731:
{{out}}
<pre>
$ ./Check_output_device_is_terminal
Output device is a terminal = true
$ ./
$ cat tmp
Output device is a terminal = false
$ ./
Output device is a terminal = false
</pre>
=={{header|zkl}}==
On Unix, check to see if stdout's st_mode is a character device.
|