unknown stream from choice.exe

This is a discussion on unknown stream from choice.exe within the Windows Programming forums, part of the Platform Specific Boards category; Hi, I'm writing a "more" like program in c that reads from stdin. I'm using ReadFile() from windows.h to read ...

  1. #1
    Registered User
    Join Date
    Jun 2009
    Location
    undisclosed
    Posts
    5

    unknown stream from choice.exe

    Hi, I'm writing a "more" like program in c that reads from stdin. I'm using ReadFile() from windows.h to read the string and changes the console color. Everyting works great except it's not working with choice.exe (from win2003 support tools, which is the 32bit version of choice.com).

    Here is a sample of what I'm talking about.
    Code:
      set /p errorlevel=[RED]enter key:[/RED] | colorize.exe
      choice /C:123 [RED]select[/RED] | colorize.exe
      choice /C:123 [RED]select[/RED] >nul
      choice /C:123 [RED]select[/RED] 2>nul
    Here, "set" worked but "choice" fails. I tried redirecting stdin and stderr but the text still shows up. Is there a third stream at work here? Is there a way to get the text?

    Thanks in advance.

  2. #2
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    612
    Error output from choice.exe, and probably all the other command line tools goes through stderr, which isn't hooked up through piping.

    Not sure how you're still seeing the error message when you use the last of the example command lines though, that stops any output from appearing for me.

  3. #3
    Registered User
    Join Date
    Jun 2009
    Location
    undisclosed
    Posts
    5
    Thanks for the reply.

    I tried piping it to more and the message disappears, so it shouldn't be the error stream then...?
    Code:
    choice /C:123 [RED]select[/RED] | more

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Discard wrong data from stream
    By mesmer in forum C Programming
    Replies: 7
    Last Post: 11-16-2008, 02:30 AM
  2. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 02:29 PM
  3. Help! About text stream and binary stream
    By Antigloss in forum C Programming
    Replies: 1
    Last Post: 09-01-2005, 09:40 AM
  4. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 11:03 AM
  5. UNICODE and GET_STATE
    By Registered in forum C++ Programming
    Replies: 1
    Last Post: 07-15-2002, 04:23 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21