Writing to the console only (without re-direction)
-
Process A launches process B with re-directed out, and err. Process B must write to the console only - no re-direction (as the output will obviously be routed back to Process A). I have tried a number of ways; including _cputs() etc. But I need a method where the output is rendered faithfully - where extended ASCII chars are written correctly. None of the 'console only' output functions seem to support this. Any suggestions? Third party libraries I might look at? Thanks in advance.
-
Process A launches process B with re-directed out, and err. Process B must write to the console only - no re-direction (as the output will obviously be routed back to Process A). I have tried a number of ways; including _cputs() etc. But I need a method where the output is rendered faithfully - where extended ASCII chars are written correctly. None of the 'console only' output functions seem to support this. Any suggestions? Third party libraries I might look at? Thanks in advance.
-
Hi Hans. Thank you for the suggestion but all of the variations of printf, cout etc .. all write to an (re-directable) output stream. I need to write the console only.
-
Hi Hans. Thank you for the suggestion but all of the variations of printf, cout etc .. all write to an (re-directable) output stream. I need to write the console only.
You might try CreateFile() with device name "CON" and dwDesiredAccess = GENERIC_WRITE.
Best wishes, Hans
-
You might try CreateFile() with device name "CON" and dwDesiredAccess = GENERIC_WRITE.
Best wishes, Hans
Thanks Hans .. I am going to try that! Cheers.
-
You might try CreateFile() with device name "CON" and dwDesiredAccess = GENERIC_WRITE.
Best wishes, Hans
Hans. Thanks a lot for the CreateFile() suggestion. It works perfectly .. I am delighted. You should create a short post about CONS only output. There is lots out there about re-direction etc .. but nothing that I could find about faithful rendering of console only output. Again .. cheers. Best regards. James.
-
Hans. Thanks a lot for the CreateFile() suggestion. It works perfectly .. I am delighted. You should create a short post about CONS only output. There is lots out there about re-direction etc .. but nothing that I could find about faithful rendering of console only output. Again .. cheers. Best regards. James.
Thanks for letting me know. For my own curiosity, can you say why you want to disallow redirection?
Best wishes, Hans
-
Thanks for letting me know. For my own curiosity, can you say why you want to disallow redirection?
Best wishes, Hans
Hi Hans. I have been writing an application for a few years now .. www.tenfiftytwo.co.uk/pipelines It's basically a multi-stream pipelines (textual manipulation) app that will allow you to chain together pipelines to transform text/data. I am developing a TRACE option that allows interactive user input to inspect i/o records and in order to do this each called process must share the same console. So, console prompts must be just that - no redirection back to the calling process. They need to be console only. Only the called process output should be captured by re-directed streams. Best regards. James. PS. Cannot believe that I did not think of CreateFile() .. thanks again.