I am wondering if anyone can help me. I've just downloaded and installed this
Dev-C++ and I wrote a simple C program then compile it . but when I want to
run it, I dont see the output in DOS as it shuld be. Can anyone help me on how
to configure this compiler to enable me to see the output in a DOS screen.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The arbitrary-looking number is the standard limit to ignoring characters left
in the input stream.
Do NOT use this code:
system("pause");
It executes the first executable with the name "pause" found. Usually this is
a system EXE that outputs "Press any key to continue..." and waits for a key.
However, this is a massive security hole; one could edit the string "pause"
with a command that causes serious harm to users.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The "pause" command is not an executable, it is built in to cmd.exe. Such code
is generally a temporary kludge used during development; you'd hardly deploy
using this, so the security issue is largely irrelevant. It is quick-and-
dirty, but that is kind of the point here.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First-time; don't post your question on BOTH forums!
I take that back; you didn't; my error, I managed to fail to post my original
answer; whcih was along teh lines of:
Having called your self "first time" it is ironic that you chose not to read
the "PLEASE READ BEFORE POSTING A
QUESTION" thread. Your problem is item (2) in the
common problems list.
However my view on this is that you should not be surprised. When a process
terminates, Windows closes its window. This is normal and desirable behaviour,
otherwise you'd have many dead windows left on your desktop waiting for you to
manually close them. It is a wonder then that users are so often surprised
when it happens to their own programs! If you want to see the output, don't
let the process terminate until you ask it to via some kind of user input.
Drmoo: You gave a C++ solution when first-time is writing C code.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello guys,
I am wondering if anyone can help me. I've just downloaded and installed this
Dev-C++ and I wrote a simple C program then compile it . but when I want to
run it, I dont see the output in DOS as it shuld be. Can anyone help me on how
to configure this compiler to enable me to see the output in a DOS screen.
C:
C++:
The arbitrary-looking number is the standard limit to ignoring characters left
in the input stream.
Do NOT use this code:
It executes the first executable with the name "pause" found. Usually this is
a system EXE that outputs "Press any key to continue..." and waits for a key.
However, this is a massive security hole; one could edit the string "pause"
with a command that causes serious harm to users.
First-time; don't post your question on BOTH forums!
Drmoo:
Yuk! What are you thinking!? No 'arbitrary' number needed; include <limits>
then:
The "pause" command is not an executable, it is built in to cmd.exe. Such code
is generally a temporary kludge used during development; you'd hardly deploy
using this, so the security issue is largely irrelevant. It is quick-and-
dirty, but that is kind of the point here.
I take that back; you didn't; my error, I managed to fail to post my original
answer; whcih was along teh lines of:
Having called your self "first time" it is ironic that you chose not to read
the "PLEASE READ BEFORE POSTING A
QUESTION" thread. Your problem is item (2) in the
common problems list.
However my view on this is that you should not be surprised. When a process
terminates, Windows closes its window. This is normal and desirable behaviour,
otherwise you'd have many dead windows left on your desktop waiting for you to
manually close them. It is a wonder then that users are so often surprised
when it happens to their own programs! If you want to see the output, don't
let the process terminate until you ask it to via some kind of user input.
Drmoo: You gave a C++ solution when first-time is writing C code.