English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 25 October 2014, 01:24   #1
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
How can I do I/O redirection to a simple console window?

I'm opening a simple console on 3.1 with
Open("CON:0/0/640/100/Console", MODE_NEWFILE)
and then I do
Execute("program", con, con)
, expecting the program to use the new console for its input and output.

Even a simple program crashes after it has output something to the window. Setting the output handle to NULL stops it from crashing, but the console turns into an interactive shell after the program has finished, and I don't want that.

Is there any simple way to get this to work, and if not, what is the correct way?

Thanks
Leffmann is offline  
Old 25 October 2014, 09:41   #2
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
This might be of help http://amigadev.elowar.com/read/ADCD.../node016C.html
alkis is offline  
Old 25 October 2014, 10:56   #3
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 7,009
Quote:
Originally Posted by Leffmann View Post
I'm opening a simple console on 3.1 with
Open("CON:0/0/640/100/Console", MODE_NEWFILE)
and then I do
Execute("program", con, con)
, expecting the program to use the new console for its input and output.

Even a simple program crashes after it has output something to the window. Setting the output handle to NULL stops it from crashing, but the console turns into an interactive shell after the program has finished, and I don't want that.

Is there any simple way to get this to work, and if not, what is the correct way?

Thanks

Now you have tried

Execute (program,con,con) and
Execute (program,con,0)

Don't you think there is at least one more combination to try?

And don't you think that reading the autodocs is also an option to answer such a question?

http://amigadev.elowar.com/read/ADCD.../node015E.html
thomas is offline  
Old 25 October 2014, 21:12   #4
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
Quote:
Originally Posted by thomas View Post
Don't you think there is at least one more combination to try?

And don't you think that reading the autodocs is also an option to answer such a question?
It's precisely because I have read the autodocs that I'm not setting the input handle to NULL, because I want to be able to enter text in the new console as well.

Quote:
Originally Posted by alkis View Post
Thanks alkis I did check System() and related calls before posting, but they require 2.0. (I meant to write "1.3" and not "3.1" in my first post)

I'm still interested in hearing if there's a quick solution that runs on 1.3 without having to go through OpenWindow(), console.device, or creating a new process on the fly.

Thanks
Leffmann is offline  
Old 25 October 2014, 22:44   #5
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 7,009
The docs clearly say that it is not allowed to set both handles to the same file.

You can append "\nEndCLI\n" to the end of your command line, then Execute will return when the command is executed. You might want to prepend "FailAt 21" to the command line so that it does not exit to the shell if something goes wrong.

"FailAt 21\nList SYS: ?\nEndCLI\n"
thomas is offline  
Old 26 October 2014, 23:42   #6
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
Thanks a lot, that's the simple solution I was looking for
Leffmann is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple Mail Help adgloride support.Apps 5 27 July 2020 21:35
Filesystem read redirection Vot Coders. General 2 07 October 2012 11:43
Execute Command Redirection Help Ed Cruse Coders. General 2 30 September 2008 16:59
A little simple tool zeGouky project.Sprites 7 05 November 2005 21:52
Printer redirection Jherek Carnelia support.WinUAE 1 14 January 2002 17:57

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:55.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07687 seconds with 13 queries