Bloodshed Dev. Compiler will only not show me my RUN execuable. Help!

M

MatthewMlane

Sorry I am new to C programming & this newsgroup. But I downloaded a C
compiler & when it runs the executable file it pops up the dos prompt & shows
my executed file but only for a nanosecond & then flips off. I cant see my
executed file. I can go to the MSDOS prompt & run it but thats a pain.
There's got to be some place to click where you can look at it until you press
a key or something. HElp
 
J

Joona I Palaste

MatthewMlane said:
Sorry I am new to C programming & this newsgroup. But I downloaded a C
compiler & when it runs the executable file it pops up the dos prompt & shows
my executed file but only for a nanosecond & then flips off. I cant see my
executed file. I can go to the MSDOS prompt & run it but thats a pain.
There's got to be some place to click where you can look at it until you press
a key or something. HElp

Your compiler's options configuration couldn't really have much less to
do with the C language. If you want further help on that, please ask in
a Microsoft newsgroup, or consult the Bloodshed Dev. Compiler customer
support directly.
However there is an easy work-around, which is a reasonably portable ISO
C solution. Simply insert a call to getchar() as the final statement of
your program, and your program will sit around waiting for a character
to appear in stdin, which usually means that it will wait until you
press Return.

--
/-- Joona Palaste ([email protected]) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"I said 'play as you've never played before', not 'play as IF you've never
played before'!"
- Andy Capp
 
E

Emmanuel Delahaye

MatthewMlane wrote on 03/09/04 :
Sorry I am new to C programming & this newsgroup. But I downloaded a C
compiler & when it runs the executable file it pops up the dos prompt & shows
my executed file but only for a nanosecond & then flips off. I cant see my
executed file. I can go to the MSDOS prompt & run it but thats a pain.
There's got to be some place to click where you can look at it until you
press a key or something. HElp

Use the code generator. The minimum example has a

#include <stdlib.h>
<...>

system ("pause");

at the end of main() call that makes the trick.


If you have several exit() calls in your code, let main() ends with

return 0;

but add the following in the beginning of main() :

#include <stdlib.h>
<...>


atexit (on_exit);

with

static void on_exit (void)
{
system ("pause");
}

placed before.

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

"C is a sharp tool"
 
C

CBFalconer

MatthewMlane said:
Sorry I am new to C programming & this newsgroup. But I downloaded
a C compiler & when it runs the executable file it pops up the dos
prompt & shows my executed file but only for a nanosecond & then
flips off. I cant see my executed file. I can go to the MSDOS
prompt & run it but thats a pain. There's got to be some place to
click where you can look at it until you press a key or something.
HElp

This is off-topic for c.l.c, but in essence you are using an IDE,
not a compiler. The IDE runs the compiler. You should get used
to using the command line - just leave the so-called dos window
open at all times, and you can get back and forth with an ALT-tab
(under windoze). Then you can learn to use it for the actual
compilation later.

For further info try the learn-c-c++ group (or something like
that) or a group that deals with your actual system.
 
E

Erik de Castro Lopo

MatthewMlane said:
Sorry I am new to C programming & this newsgroup. But I downloaded a C
compiler & when it runs the executable file it pops up the dos prompt & shows
my executed file but only for a nanosecond & then flips off. I cant see my
executed file. I can go to the MSDOS prompt & run it but thats a pain.
There's got to be some place to click where you can look at it until you press
a key or something. HElp

Try this program:


#include <stdio.h>
int main (void)
{ puts ("Press the <enter> key to exit.");
getchar ();
return 0;
}

Erik
--
+-----------------------------------------------------------+
Erik de Castro Lopo (e-mail address removed) (Yes it's valid)
+-----------------------------------------------------------+
"There is no satisfactory substitute for excellence."
-- Dr. Arnold O. Beckman
 
M

Michael Scarlett

Erik de Castro Lopo said:
Try this program:


#include <stdio.h>
int main (void)
{ puts ("Press the <enter> key to exit.");
getchar ();
return 0;
}

Erik

at least you replied eric. I understand this is a c.l.c but that's a
pretty n00bie question and it takes 1 line of code to show the guy
what to do. You guys need to chill a bit and stop being so esoteric
and snotty. *only words i could think of *
 
M

MatthewMlane

Thanks for your help guys. You helped out the ultimate noobie. I've tried the
GetCHar & the Pause & they both work fine.

Also another off topic maybe question? Is it worth the extra money to buy the
Microsoft C++ compiler? I might be able to get it for a discount.
 
C

CBFalconer

MatthewMlane said:
.... snip ...

Also another off topic maybe question? Is it worth the extra
money to buy the Microsoft C++ compiler? I might be able to get
it for a discount.

Probably not. Microsoft has announced that they will never make
it C99 compliant, they don't fix bugs, and you should eschew all
Microsoft software on principal. Whatever you get out of it will
only work on Microsoft OSs (and probably not even there after a
few years), while better systems can supply you cross-compilers
and whatnot.

Unless you have an absolute requirement for it, no.
 
M

Michel Bardiaux

CBFalconer said:
MatthewMlane wrote:

... snip ...



Probably not. Microsoft has announced that they will never make
it C99 compliant,

Could you point me to an URL with an official statement to that effect?
 
R

Richard Bos

Also another off topic maybe question? Is it worth the extra money to buy the
Microsoft C++ compiler? I might be able to get it for a discount.

I've only been using Dev-C for a short while, but I'm quite satisfied. I
gather M$C comes with more bells and whistles (for example, with an icon
editor, which I had to write myself to do chapter 10 in Petzold's
Programming in Windows), but if you can do without those or have them
from somewhere else, I see no reason to use M$C.
Unless, of course, you need to be object-compatible with its output.
Then you're effectively locked in. But for most applications, I'd say
stick with Dev-C.

Richard
 
J

Joona I Palaste

I doubt that you'll ever find such an "official statement", but Stan
Lippman (MS Architect for Visual C++) said in an interview that
Microsoft will not simply implement features because they are
specified in the standard.

Of course, Lippman realises that this really prevents Microsoft from
calling Visual C++ a C compiler? They can call it a "Microsoft C"
compiler where "Microsoft C" and C are different languages sharing a
considerably large intersection.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top