Jump to content

Check output device is a terminal: Difference between revisions

m
→‎{{header|Wren}}: Small change to Wren and C file names.
m (→‎{{header|Wren}}: Minor tidy)
m (→‎{{header|Wren}}: Small change to Wren and C file names.)
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="wren">/* Check_output_device_is_terminalCheck_output_device_is_a_terminal.wren */
 
class C {
Line 711:
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "Check_output_device_is_terminalCheck_output_device_is_a_terminal.wren";
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
Line 731:
{{out}}
<pre>
$ ./Check_output_device_is_a_terminal
$ ./Check_output_device_is_terminal
Output device is a terminal = true
 
$ ./Check_output_device_is_terminalCheck_output_device_is_a_terminal > tmp
$ cat tmp
Output device is a terminal = false
 
$ ./Check_output_device_is_terminalCheck_output_device_is_a_terminal | cat
Output device is a terminal = false
</pre>
9,482

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.