Thread: [Dev-C++] Dev-C++] won't let me see the results
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: qian h. <ha...@gm...> - 2007-11-05 01:46:54
|
Dear all, I was experiencing a problem as follows: after compiling (successfully) the Dev C++ immediately shuts off the output window, not letting me have a chance to look at the result. The output windows flashes and then disappeares. MSF C++ doesn't have this problem, but I really don't want to switch back to that. Does anybody know what the problem is and how to resolve it? Thanks a lot. |
|
From: Per W. <pw...@ia...> - 2007-11-05 02:53:20
|
Dev-C++ is behaving the standard Windows way, i.e. console applications
started from a graphical program closes as soon as the application ends.
Just add a system("pause") command at the end of main(), or add a command
to read from stdin.
/pwm
On Sun, 4 Nov 2007, qian han wrote:
> Dear all,
>
> I was experiencing a problem as follows: after compiling (successfully) the
> Dev C++ immediately shuts off the output window, not letting me have a
> chance to look at the result. The output windows flashes and then
> disappeares.
>
> MSF C++ doesn't have this problem, but I really don't want to switch back to
> that.
>
> Does anybody know what the problem is and how to resolve it? Thanks a lot.
>
|
|
From: Chris M. <lor...@gm...> - 2007-11-05 03:10:18
|
Per Westermark wrote:
> Dev-C++ is behaving the standard Windows way, i.e. console applications
> started from a graphical program closes as soon as the application ends.
>
> Just add a system("pause") command at the end of main(), or add a command
> to read from stdin.
>
As a matter of practise, it's better to include either iostream or stdio
and to either cin; or to scanf();, since that's more cross-platform.
system("pause") only works on Windows platforms, which is a really bad
thing IMHO. I often write code that needs to work on UNIX and Win32
platforms, so it's best to learn to write the right way, as opposed to
having to run through and change a bunch of code later.
If someone knows a more elegant way still, I'm totally open to that.
Including either of those console libraries adds a significant size to
the resultant binary, so if there's something else I'm not aware of, I'd
love to hear it :)
|
|
From: seb_kramm <seb...@ya...> - 2007-11-05 08:42:09
|
Chris Miller a écrit :
> Per Westermark wrote:
>> Dev-C++ is behaving the standard Windows way, i.e. console applications
>> started from a graphical program closes as soon as the application ends.
>> Just add a system("pause") command at the end of main(), or add a command
>> to read from stdin.
>>
> As a matter of practise, it's better to include either iostream or stdio
> and to either cin; or to scanf();, [...]
> If someone knows a more elegant way still, I'm totally open to that.
Sure: ;-)
#ifdef __WIN32__
system("pause");
#endif
Do the same for the header file include (can't remember wich one it is at present),
so it can't mess up other stuff in case of a non-win32 build.
|
|
From: Per W. <pw...@ia...> - 2007-11-05 09:20:13
|
We are not talking about cross-platform. We are talking about the ability
to test a new application. Whatever works is good enough.
Portability is only meaningful if you write a special module to link into
the application that will autodetect if the program is run from the
command-line or started from a graphical environment.
/pwm
On Sun, 4 Nov 2007, Chris Miller wrote:
> Per Westermark wrote:
> > Dev-C++ is behaving the standard Windows way, i.e. console applications
> > started from a graphical program closes as soon as the application ends.
> >
> > Just add a system("pause") command at the end of main(), or add a command
> > to read from stdin.
> >
> As a matter of practise, it's better to include either iostream or stdio
> and to either cin; or to scanf();, since that's more cross-platform.
> system("pause") only works on Windows platforms, which is a really bad
> thing IMHO. I often write code that needs to work on UNIX and Win32
> platforms, so it's best to learn to write the right way, as opposed to
> having to run through and change a bunch of code later.
>
> If someone knows a more elegant way still, I'm totally open to that.
> Including either of those console libraries adds a significant size to
> the resultant binary, so if there's something else I'm not aware of, I'd
> love to hear it :)
>
|
|
From: Philip B. <phi...@pb...> - 2007-11-05 08:11:31
|
iostream adds a lot to the size of the executable due to license issues.
stdio however, does not. If you are writing a C++ application you'll want to
include cstdio rather than stdio.h, I found that you get a smaller
executable that way. I dislike iostream to begin with anyway, I only use it
when I absolutely have to. stdio is the way to go if you ask me, but that's
a matter of personal preference.
Regards
Philip Bennefall
----- Original Message -----
From: "Chris Miller" <lor...@gm...>
To: "Per Westermark" <pw...@ia...>
Cc: <dev...@li...>
Sent: Monday, November 05, 2007 4:10 AM
Subject: Re: [Dev-C++] Dev-C++] won't let me see the results
> Per Westermark wrote:
>> Dev-C++ is behaving the standard Windows way, i.e. console applications
>> started from a graphical program closes as soon as the application ends.
>>
>> Just add a system("pause") command at the end of main(), or add a command
>> to read from stdin.
>>
> As a matter of practise, it's better to include either iostream or stdio
> and to either cin; or to scanf();, since that's more cross-platform.
> system("pause") only works on Windows platforms, which is a really bad
> thing IMHO. I often write code that needs to work on UNIX and Win32
> platforms, so it's best to learn to write the right way, as opposed to
> having to run through and change a bunch of code later.
>
> If someone knows a more elegant way still, I'm totally open to that.
> Including either of those console libraries adds a significant size to
> the resultant binary, so if there's something else I'm not aware of, I'd
> love to hear it :)
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|