Article View: borland.public.cppbuilder.nativeapi
Article #13042Re: Displaying stdout in dos box
From: Denville Longhurst
Date: Fri, 31 Oct 2003 10:07
Date: Fri, 31 Oct 2003 10:07
58 lines
3649 bytes
3649 bytes
Thanks for the interest. I am convering a legacy DOS application to run under Windows. I have encapsulated the DOS code substantially intact within a GUI host application. This particular app is called from within a batch file; if 'my' application detects an error within itself or with its data sources that it cannot correct then it closes with a particular error code, which the batch file uses to then run one or other of two contingency applications (not under my control) to recover from the problem or to close the whole system down gracefully (hence my recent query about returning a non-zero error code from a GUI app). The problem is that the diagnostic message which my app displays (and logs) prior to closing is lost as soon as it closes. What I am trying to replicate is a scheme where I can copy the essential message(s) back to the DOS console so that an observer can still reas them in the DOS box even after my app has closed and the contingency app has run up. I do not agree that GUI processes do not use STDOUT. If I place a printf(...) in the gui app, its output appears to be lost (and thus I have edited the legacy app and replaced all of the printf's with routines to display in a more appropriate way). However, if I call the app with something like MYAPP >MYFILE the stdout is directed to a file named MYFILE. Similarly, MYAPP | MORE pipes stdout to the DOS box via MORE and almost achieves what I want. The only complication is that MORE potentially compromises the display if it is near the bottom of the screen waiting for the user to press Enter, and this is different from what the current users expect and are trained for, and is not acceptable. I am tempted to write a MORE - like utility to achieve what I want but this seem overkill if there is a simpler way. So, the basic question is: How, from within a GUI applicatiuon running in a DOS box, can I write text to that DOS box. Denville. "Remy Lebeau (TeamB)" <gambit47.no.spam@no.spam.yahoo.com> wrote in message news:3f9ffb90$1@newsgroups.borland.com... > > "Denville Longhurst" <Denville@metco.co.uk> wrote in message > news:3f9fe982@newsgroups.borland.com... > > Running a gui app from a command box, I need to display > > stdout in the cmd box (in case the app fails to start, then the > > status messages remain visible in the cmd box). > > GUI processes do not use STDOUT. > > > I know stdout is getting directed back to the cmd environment > > because I can enter APP >TEST and stdout will go to a file > > named TEST. > > What exactly are you trying to accomplish? > > > Gambit > >
Technical Details
Message-ID:
<3fa23451$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!peernews3.colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f9fe982@newsgroups.borland.com> <3f9ffb90$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,e00744b422e64f48 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-10-31 02:09:15 PST From: "Denville Longhurst" <Denville@metco.co.uk> Newsgroups: borland.public.cppbuilder.nativeapi References: <3f9fe982@newsgroups.borland.com> <3f9ffb90$1@newsgroups.borland.com> Subject: Re: Displaying stdout in dos box Date: Fri, 31 Oct 2003 10:07:21 -0000 Lines: 60 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2727.1300 NNTP-Posting-Host: 80.0.6.170 Message-ID: <3fa23451$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1067594833 80.0.6.170 (31 Oct 2003 02:07:13 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!peernews3.colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail