#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    2
    Rep Power
    0

    Console app and processes Q


    Hi all,

    Two Q's, the first concerns a console app I am using to create a process in Visual C++. I use the console app to lauch a windows app. While the windows app is alive, anything that is written to the console wont appear until the windows app (being the created process) is killed off. I need to display data on the command console while the windows app is still alive. How do I do this?? (ie change focus)

    Secon Q is, rather than having the familiar "Press any key to continue", what code do I use to just get the console to automatically close once the created process is killed??

    Cheers.
    Last edited by sallas; August 27th, 2003 at 06:52 AM.
  2. #2
  3. I'm Baaaaaaack!
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Jul 2003
    Location
    Maryland
    Posts
    5,538
    Rep Power
    243
    First, you can try 'fflush(NULL)' in your windows app from time to time, the OS buffers writes to stdout, or you can try writing to stderr (cout vs cerr in C++).

    Second, are you running the program from the IDE by clicking on the exclamation point? If so, there is an automagic trap to give you the chance to look at your output. Try running it directly from the exe created.

    My blog, The Fount of Useless Information http://sol-biotech.com/wordpress/
    Free code: http://sol-biotech.com/code/.
    Secure Programming: http://sol-biotech.com/code/SecProgFAQ.html.
    Performance Programming: http://sol-biotech.com/code/PerformanceProgramming.html.
    LinkedIn Profile: http://www.linkedin.com/in/keithoxenrider

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    2
    Rep Power
    0

    Thumbs up


    My friend, you have done well!!!!!!

    Firstly, I substituted cout with cerr as sugested, now the dots increment.

    Secondly, how embarrising, yes on creating the .exe, the console disapears as I was running within the compiler!

    Thankyou very much, now it being 1:30 in the morning I can go to bed and not worry so much!!

    Thank you once again!

IMN logo majestic logo threadwatch logo seochat tools logo