0

I'm using Dev-C++ to develop some console apps to study. When my program tries to run

system("PAUSE");

ZA stops it and asks me to allow or deny it. I check the "always" box but it seems that every time I compile it, it generates a new exe file so every time I run it ZA pops up.

Of course the simplest solution is to disable it or deal with it :-P but I'm not eager for any of both. Any suggestions? thanks in advance!

MoonSire
  • 939
rMaero
  • 41
  • 6

1 Answers1

2

Get rid of system("PAUSE"). If you want to wait for a keypress, use sensible C or C++ code to do that. Don't launch a process.

Also, console applications should never wait for a keypress at the end of their run. Among other things, this makes them unusable in pipelines. If you need the output of a console application after it finishes running, you should run it from a console.

It's not the program's responsibility to ensure it's run in a sane environment. If run from a temporary console, its output will be temporary as it should be. Someone who didn't want that wouldn't run it from a temporary console.

This annoys people who know what they're doing (imagine if you redirect the program's output to a file, for example) and just facilitates people who don't know they're doing to continue to ask for things other than what they want, continuing the cycle of programmers giving them what they didn't ask for.