How to send output to the main program using shell?

DOS specific questions.
Post Reply
Bob Paw
Posts: 8
Joined: Nov 23, 2014 14:22

How to send output to the main program using shell?

Post by Bob Paw »

Say:

Code: Select all

if shell("if exist settings.txt ...) ... then
dothis
andthis
end if
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: How to send output to the main program using shell?

Post by fxm »

Code: Select all

If Shell("Echo." + "if exist settings.txt ...") = 0 Then
  Print
  Print "Ouput by Shell() successful"
End If
Sleep
Bob Paw
Posts: 8
Joined: Nov 23, 2014 14:22

Re: How to send output to the main program using shell?

Post by Bob Paw »

What about, if it exists, sending a variable to the main program?
dkl
Site Admin
Posts: 3235
Joined: Jul 28, 2005 14:45
Location: Germany

Re: How to send output to the main program using shell?

Post by dkl »

And to read the console output of a launched program, there is Open Pipe:
KeyPgOpenPipe
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: How to send output to the main program using shell?

Post by TJF »

The direct way is often the best ...

Code: Select all

VAR fnam = "settings.txt", fnr = FREEFILE
IF 0 = OPEN(fnam FOR INPUT AS fnr) THEN
  CLOSE #fnr
  ?"Do this ..."
  ?"Do that ..."
END IF
Post Reply