[SOLVED] Linux: How to detect whether STDOUT was redirected? lazarus / 32-Linux ---------------------------------------------------------------------- Hartmut · 2018-09-28 16:38 I want a function which tells me, whether STDOUT of my console program was redirected or not like    myprogram > outfile In http://forum.lazarus.freepascal.org/index.php/topic,41936.0.html there is a solution for Windows, but I need it for Linux (Ubuntu 18.04). Can somebody help? I'm an absolute beginner on Linux, so please be not to short in your answer. Thanks a lot in advance. ---------------------------------------------------------------------- mpv · 2018-09-28 19:08 You can check stdout is a terminal using isatty() function. If not then stdout is redirected ---------------------------------------------------------------------- Hartmut · 2018-09-28 19:41 That sounds interesting. But I don't find this function, in which unit is it? http://www.math.uni-leipzig.de/pool/tuts/FreePascal/units/node12.html# SECTION0012369000000000000000 says it is in unit "Linux", but I still get a compilation error: Identifier not found "IsATTY" Thanks for your help. ---------------------------------------------------------------------- alex256 · 2018-09-28 19:50 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses    termio; ---------------------------------------------------------------------- Thaddy · 2018-09-28 20:04 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$ifdef fpc}{$mode delphi}{$H+}{$endif}uses termio;beginwriteln(IsATTY(output));end. ---------------------------------------------------------------------- Thaddy · 2018-09-28 20:05 Alex , posts crossed. ---------------------------------------------------------------------- Hartmut · 2018-09-28 20:13 It works! Thanks a lot to all who helped me.