Author Topic: Newbie Question About the Code at the end  (Read 3087 times)

bingobeawr

  • Guest
Newbie Question About the Code at the end
« on: August 03, 2008, 04:06:44 am »
I noticed that CodeBlocks have built in code for not closing a window when the program is executed. While in Other compilers you use such code as
       std::cout << "Press the enter key to exit";
        std::cin.ignore(std::cin.rdbuf()->in_avail()+1);

Where can I find the script to edit this in Code Blocks.

elzorro

  • Guest
Re: Newbie Question About the Code at the end
« Reply #1 on: August 05, 2008, 12:29:50 am »
I think it's not in any script.

In the windows version there is an executable named "cb_console_runner.exe" in codeblocks installation directory that handles execution of the programs.

If you type "C:\CodeBlocks\cb_console_runner.exe calc.exe" it runs calc.exe and when you close the application it prints the message you mention and pauses the console until you press a key. Replace "C:\CodeBlocks" with your installation directory and calc.exe with your executable

Maybe you could make your own "cb_console_runner.exe" and replace it, or search in the source of codeblocks.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Newbie Question About the Code at the end
« Reply #2 on: August 05, 2008, 11:15:28 am »
If you don't want that behaviour, turn it off in the project options. No need to change code.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."