![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jul 2004
Posts: 8
Rep Power: 0
![]() |
Hi
Is there any way to write from the same program in many command prompts ? More specifically I use win XP and MS Visual C++ v6. All we know that with a simple printf or cout we can write to the command prompt of our application. But if we want to have two command prompts running in the same application how can we redirect the print or cout output to write in the first or second command prompt ? I know the existence of system(“cmd”); function ( and also I know that is not a safe command but my application is only for me and not commercial ) . This function it only opens new commands prompts without giving the ability to write into them ? Is there any solution ? Also if there is an answer for the previous questions , how can I pass and execute some commands ( dir ,exit ) in that command prompts ? Thanks |
|
|
|
|
|
#2 |
|
Programming Guru
![]() ![]() ![]() |
Redirect your output to dynamically created batch files... then have an instance to execute each batfile via the cmd function.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Sep 2004
Posts: 38
Rep Power: 0
![]() |
If you want to write to and/or read from a console process you can use popen (or _popen in DOS). This forks and execs a process and returns a FILE * tied to stdin, stdout, or both depending on the final arg you pass in. It works a lot like a 'system' call you can interact with programatically.
|
|
|
|
|
|
#4 |
|
Programming Guru
![]() ![]() ![]() |
Interesting, I'll have to look into that myself.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|