Dev-C++ 4.9.9.0 Newbe question

Discussion in 'C Programming' started by Les Coover, Aug 2, 2003.

  1. Les Coover

    Les Coover Guest

    #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?
    Les Coover, Aug 2, 2003
    #1
    1. Advertising

  2. Les Coover

    Andy Zhang Guest

    "Les Coover" <> wrote in message
    news:CNEWa.123235$...
    > #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.

    --
    Andy Zhang
    Andy Zhang, Aug 2, 2003
    #2
    1. Advertising

  3. Les Coover

    Les Coover Guest

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


    "Artie Gold" <> wrote in message
    news:...
    > Les Coover wrote:
    > > #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?
    > >

    >
    > Give it a reason to do so, like having it wait to read a character (put
    > a call to getchar() after the printf).
    >
    > --ag
    >
    >
    > --
    > Artie Gold -- Austin, Texas
    >
    Les Coover, Aug 2, 2003
    #3
  4. Les Coover

    Les Coover Guest

    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


    "Andy Zhang" <> wrote in message
    news:J2HWa.30234$...
    >
    > "Les Coover" <> wrote in message
    > news:CNEWa.123235$...
    > > #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.
    >
    > --
    > Andy Zhang
    >
    >
    Les Coover, Aug 2, 2003
    #4
  5. Les Coover

    Andy Zhang Guest

    "Les Coover" <> wrote in message
    news:qqHWa.124041$...
    > 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.

    --
    Andy Zhang
    Andy Zhang, Aug 2, 2003
    #5
  6. Andy Zhang wrote:

    > 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.

    --
    Richard Heathfield :
    "Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
    C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
    K&R answers, C books, etc: http://users.powernet.co.uk/eton
    Richard Heathfield, Aug 2, 2003
    #6
  7. On Sat, 02 Aug 2003 14:25:11 GMT, Joe Wright <> wrote:

    >Serve Laurijssen wrote:
    >>
    >> "Richard Heathfield" <> wrote in message
    >> news:bgft1k$f5a$...
    >> > Andy Zhang wrote:
    >> >
    >> > > 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.

    >>
    >> Exactly. It's offtopic, but I've even seen students that put spaces in
    >> virtual directories. What happened to common sense?

    >
    >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>
    Alf P. Steinbach, Aug 2, 2003
    #7
  8. Les Coover

    Buck Rogers Guest


    >
    > 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
    Buck Rogers, Aug 3, 2003
    #8
  9. Les Coover

    Buck Rogers Guest

    "Buck Rogers" <> wrote in message
    news:dUXWa.348$...
    >
    > >
    > > 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
    >

    Actually, this might be better:

    http://www.bloodshed.net/faq.html
    Buck Rogers, Aug 3, 2003
    #9
  10. Les Coover

    Buck Rogers Guest

    "Les Coover" <> wrote in message
    news:CNEWa.123235$...
    > #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.
    Buck Rogers, Aug 3, 2003
    #10
  11. Les Coover

    Dan Pop Guest

    In <> (Alf P. Steinbach) writes:

    >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
    --
    Dan Pop
    DESY Zeuthen, RZ group
    Email:
    Dan Pop, Aug 4, 2003
    #11
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ron Peterson

    /dev/urandom vs. /dev/random

    Ron Peterson, Jan 7, 2005, in forum: C Programming
    Replies:
    21
    Views:
    1,502
    Keith Thompson
    Jan 13, 2005
  2. AC
    Replies:
    0
    Views:
    151
  3. Guest
    Replies:
    2
    Views:
    139
    Bob Barrows [MVP]
    Sep 18, 2005
  4. Eirikur Hallgrimsson
    Replies:
    3
    Views:
    149
    Gavin Sinclair
    Oct 10, 2004
  5. Michele Dondi
    Replies:
    1
    Views:
    134
    Anno Siegel
    Feb 22, 2004
Loading...

Share This Page