PC Review


Reply
Thread Tools Rate Thread

Detecting redirection of standard ports

 
 
=?Utf-8?B?UElFQkFMRA==?=
Guest
Posts: n/a
 
      13th Jan 2005
I often write console programs that need to detect when stdin and stdout are
redirected.

I found out how to detect this for stdin by using API calls GetStdHandle()
and PeekConsoleInput() (from a Dr. GUI article).

But I still need to detect such for stdout, is there a way?

And shouldn't this be a property of the standard streams?
 
Reply With Quote
 
 
 
 
Henry Jia
Guest
Posts: n/a
 
      14th Jan 2005
How about use the Console class?

"PIEBALD" <(E-Mail Removed)> wrote in message
news:CB5746A3-0CD1-4377-B7CE-(E-Mail Removed)...
> I often write console programs that need to detect when stdin and stdout

are
> redirected.
>
> I found out how to detect this for stdin by using API calls GetStdHandle()
> and PeekConsoleInput() (from a Dr. GUI article).
>
> But I still need to detect such for stdout, is there a way?
>
> And shouldn't this be a property of the standard streams?



 
Reply With Quote
 
=?Utf-8?B?UElFQkFMRA==?=
Guest
Posts: n/a
 
      14th Jan 2005
Well, of course I'm using the Console class, but it has no built-in detection
for redirection. It allows one to redirect, but won't tell you whether or not
it's _already_ redirected.
 
Reply With Quote
 
=?Utf-8?B?UElFQkFMRA==?=
Guest
Posts: n/a
 
      24th Jan 2005
No one has any ideas?
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Detecting Com Ports Coe Microsoft Dot NET Compact Framework 0 21st Aug 2006 05:28 PM
Different USB drivers für extra PCI-USB Ports than for standard USB ports? Mbene Ovambo Windows XP Hardware 6 26th Feb 2005 12:46 AM
Different USB drivers für extra PCI-USB Ports than for standard USB ports? Mbene Ovambo Windows XP General 0 24th Feb 2005 07:33 PM
Different USB drivers für extra PCI-USB Ports than for standard USB ports? Mbene Ovambo Microsoft Windows 2000 0 24th Feb 2005 07:33 PM
Different USB drivers für extra PCI-USB Ports than for standard USB ports? Mbene Ovambo Windows XP Help 0 24th Feb 2005 07:33 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:47 AM.