|
| |||||||||
| Tags: readfile, sdtin, stdout, writefile |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| [Named Pipe] Redirection of STDIN and STDOUT
Hello, Before I make this code and after some searching, I wanted to know if it is possible to redirect STDOUT and SDTIN to "Named Pipes" which was created by another process. The goal is to quickly change the code of a console application that interacts with the user. Check it to launch if the "named piped exists, if so, it redefines the standard flow, otherwise we keep the default ones. Apparently, I would have to turn to the dup () but I am pissed off is that it takes an integer parameter and CreateNamedPipe () returns a handle ... So I think that this will not work, I am wrong? Is this possible and if this is true, how do I do to achieve it "simply" because I want to avoid setting a mechanism for ReadFile () and WriteFile (), unless I have the choice ... NB: The choice of "pipe" is a design choice because I also used when creating another process using CreateProcess (). |
|
#2
| |||
| |||
| Re: [Named Pipe] Redirection of STDIN and STDOUT Quote:
As for your function dup (), I do not know what it is. However, if you wish to obtain a handle to your pipe, you have to CreateFile (), as often elsewhere. You can also use CallNamedPipe () that combines several functions, including the previous one, to establish an easy interaction with your named pipes. Finally, with regard to the redirection, you must turn to SetStdHandle () which handles the input and output (STD_OUTPUT_HANDLE. ..) are substituted by those tubes. That is quite a summary of the thing that will allow you to move forward. |
|
#3
| ||||
| ||||
| Re: [Named Pipe] Redirection of STDIN and STDOUT Quote:
Quote:
I use the IDE Code: Blocks and MinGW as compiler. Thank you! |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "[Named Pipe] Redirection of STDIN and STDOUT" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help on 2k8r2 domain controller named pipe policy | Domon | Windows Server Help | 1 | 07-12-2011 12:43 AM |
| stdin:error0? What is this? | NewComer | Operating Systems | 3 | 24-04-2010 11:56 PM |
| Inter-thread communication with stdout | Captain Carrot | Software Development | 5 | 12-03-2010 12:34 PM |
| How can I Redirect stderr into stdout ? | TALA | Software Development | 4 | 27-02-2009 08:28 PM |
| Named Pipe lsass.exe | Marbles | Windows Security | 7 | 28-05-2007 05:31 AM |