By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,870 Members | 1,236 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,870 IT Pros & Developers. It's quick & easy.

how to keep console window open

P: n/a
When I spawn a console application from a another
application of mine using
_spawnl(_P_NOWAIT, my_program, ......),
it opens a new console window but when it is finished the
window is automatically closed.

Is there any way I can keep the window open even after the
program terminated (I want to be able check the output) ?

Thank you.
Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Bumbrlik wrote:
When I spawn a console application from a another
application of mine using
_spawnl(_P_NOWAIT, my_program, ......),
it opens a new console window but when it is finished the
window is automatically closed.

Is there any way I can keep the window open even after the
program terminated (I want to be able check the output) ?


You can allocate the console before executing the app.

Just call "AllocConsole();".
After you checked the output you can call "FreeConsole();"

It works at least for CreateProcess (but should also work for spawn;
because it uses CreateProcess).
--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/useritems/leakfinder.asp
Nov 16 '05 #2

P: n/a
Thank you, that works great !!!
-----Original Message-----
Bumbrlik wrote:
When I spawn a console application from a another
application of mine using
_spawnl(_P_NOWAIT, my_program, ......),
it opens a new console window but when it is finished the window is automatically closed.

Is there any way I can keep the window open even after the program terminated (I want to be able check the
output) ?
You can allocate the console before executing the app.

Just call "AllocConsole();".
After you checked the output you can call "FreeConsole();"

It works at least for CreateProcess (but should also work for spawn;because it uses CreateProcess).
--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/useritems/leakfinder.asp
.

Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.