Dev-C++ 4.9.9.0 Newbe question

L

Les Coover

#include <stdio.h>

int main(void)
{
printf("Hello, world!\n");
return 0;

}

Very simple code When I compile and run using Dev-C++ 4.9.9.0 the
output window flashes by and does not stay open.

What do I need to do so output window will remain open?
 
A

Andy Zhang

Les Coover said:
#include <stdio.h>

int main(void)
{
printf("Hello, world!\n");
return 0;

}

Very simple code When I compile and run using Dev-C++ 4.9.9.0 the
output window flashes by and does not stay open.

What do I need to do so output window will remain open?

Windows does that. Try running your program from a command prompt.
 
L

Les Coover

Thanks Artie, got it to work. My first C code.


Artie Gold said:
Give it a reason to do so, like having it wait to read a character (put
a call to getchar() after the printf).

--ag
 
L

Les Coover

In the MS-DOS Prompt after C:\WINDOWS> I typed Hello.exe but all it does
is say Bad command or file name.

Any suggestions
 
A

Andy Zhang

Les Coover said:
In the MS-DOS Prompt after C:\WINDOWS> I typed Hello.exe but all it does
is say Bad command or file name.

Any suggestions

You have to go to the directory hello.exe is located in. Do 'cd path'. Use
drive letter: (dont forget the colon) to change drives. Alternatively, you
could enter the full path to the program on the command line:

c:\windows> c:\programs\hello\hello.exe

Just remember to put quotes around paths with spaces in them.
 
R

Richard Heathfield

Andy said:
Just remember to put quotes around paths with spaces in them.

Better yet, don't put spaces in pathnames. Ever. At least, not whilst you're
living on /my/ planet.
 
A

Alf P. Steinbach

Not that common anymore. Consider "My Documents" and "Program Files"
that encourages the nonsense.

<ot>
Spaces in pathnames are not inherently problematic. They are problematic
in practice because (1) in Unix pathnames have conventionally not contained
spaces, and so many/most Unix programs don't deal correctly with spaces, and
(2) Windows is an unclean design with many quirks (lack of quoting mechanisms,
two widely different limits on path lengths, etc.) which cause spaces in
pathnames to be problematic in some situations. The advice "don't use them"
is unsound since ordinary users _will_ use them; instead, construct your
program(s) so that they handle spaces in pathnames correctly.
</ot>
 
B

Buck Rogers

Very simple code When I compile and run using Dev-C++ 4.9.9.0 the
output window flashes by and does not stay open.

What do I need to do so output window will remain open?

#bloodshed IRC channel : the #bloodshed channel has recently been created on
the Undernet IRC server.
I will be please to talk with you there so feel free to join :) If you want
have an IRC client you can get one for
Windows at mirc.com and for Linux at xchat.org
 
B

Buck Rogers

Buck Rogers said:
#bloodshed IRC channel : the #bloodshed channel has recently been created on
the Undernet IRC server.
I will be please to talk with you there so feel free to join :) If you want
have an IRC client you can get one for
Windows at mirc.com and for Linux at xchat.org
Actually, this might be better:

http://www.bloodshed.net/faq.html
 
B

Buck Rogers

Les Coover said:
#include <stdio.h>

int main(void)
{
printf("Hello, world!\n");
return 0;

}

Very simple code When I compile and run using Dev-C++ 4.9.9.0 the
output window flashes by and does not stay open.

What do I need to do so output window will remain open?

Ok, after making some half-baked suggestions, here's what I've come up with.

When you compile a program, it creates a DOS .exe file.

When you try to run the file in Dev-C++, a DOS window is opened to run the
..exe file, and then the DOS window closes so fast so you can't see the
output.

What you need to do is to open up a DOS command prompt from the Windows
START menu, go(using DOS command line commands) into the directory where
you've stored the compiled .exe file and then run the file by typign the
filename
without the .exe extension at the end.

This WILL work, I've just done it with your program above.

This means you don't need to use getchar() in your program.

Buck

ps - if you don't know how to navigate using DOS commands, then you will
have
a problem.
 
D

Dan Pop

In said:
Spaces in pathnames are not inherently problematic.

They are problematic in any command line environment, because they require
quoting: command line interpreters use space as an argument separator.
They are problematic
in practice because (1) in Unix pathnames have conventionally not contained
spaces, and so many/most Unix programs don't deal correctly with spaces, and
^^^^^^^^^

Care to provide some concrete examples?

fangorn:~ 2186> touch "foo bar"
fangorn:~ 2187> ls -l foo\ bar
-rw-r--r-- 1 danpop sysprog 0 Aug 4 19:10 foo bar
fangorn:~ 2188> wc 'foo bar'
0 0 0 foo bar

All the forms of space quoting I could think of have properly worked.
A Unix program couldn't care less about embedded spaces in path names.

OTOH, they can be extremely confusing to the Unix *user*:

fangorn:~/clean 2201> rm *
fangorn:~/clean 2202> touch foo bar
fangorn:~/clean 2203> touch 'foo bar'
fangorn:~/clean 2204> ls
bar foo foo bar

Dan
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top