I think somethings wrong

This is a discussion on I think somethings wrong within the C Programming forums, part of the General Programming Boards category; I don't know how to program yet, but im ready to learn. My compiler is Lcc. I did the "Hello ...

  1. #1
    Unregistered
    Guest

    Unhappy I think somethings wrong

    I don't know how to program yet, but im ready to learn.
    My compiler is Lcc. I did the "Hello World" Tutorial thing
    5 times already, but when i try to run it the window flashes on and right back off agian faster then the blink of an eye.
    Did i do something wrong???
    HELP!!!!!!

  2. #2
    Im back! shaik786's Avatar
    Join Date
    Jun 2002
    Location
    Bangalore, India
    Posts
    345
    I assume you are working under Windows and programming under DOS mode. To execute the program, open a new "Command Prompt" window, and there type the executable filename.

  3. #3
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    >Did i do something wrong???

    No, I don't think so. But I think you've created a DOS console application under Windows. When the program is started, the console is opened and when it has finished running, then the console is closed. That's why you see it flahs on and off.

    So do as shaik786 told, open a console and run the program from there.

  4. #4
    Registered User
    Join Date
    Jun 2002
    Posts
    14

    Cool i had faced the same problem,here's the solution!

    just add this line at the ending braces of your main function!

    so it would lokk like this...

    #include<stdio.h>
    #include<conio.h>

    main()
    {

    printf("hello world!");


    getch();
    }


    now the console screen will not be dismissed untill you press any key.



    s_ruchit@hotmail.com
    Ruchit,
    think big,think ahead,
    go big,go ahead,

    ISN'T IT TOO FUNNY ABOUT MICROSOFT WINDOWS,THAT
    WHENEVER YOU WANT TO DO SOMETHING YOU CLICK ON "START" BUTTON AND THE FIRST OPTION YOU ARE HAVING IS
    "SHUT DOWN"...

  5. #5
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    Look a couple of pages ahead in the tutorial. My book did the exact same thing. It gave me the code you used first, then solved the problem by doing what s_ruchit just did.

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    Of course, getchar() from stdio.h is better since getch() is a nonstandard function and may not be supported.

    -Prelude
    My best code is written with the delete key.

  7. #7
    Registered User
    Join Date
    Sep 2001
    Posts
    305
    of course this is in the faq.

  8. #8
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >of course this is in the faq
    And just how many people whom you think need to read the FAQ actually read it?

    -Prelude
    My best code is written with the delete key.

  9. #9
    Registered User
    Join Date
    Sep 2001
    Posts
    305
    Originally posted by Prelude
    >of course this is in the faq
    And just how many people whom you think need to read the FAQ actually read it?

    -Prelude
    everyone should, stop jynxing the faq!

  10. #10
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >stop jynxing the faq!
    Too late, it was jinxed by being named FAQ.

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 12-05-2003, 05:36 PM
  2. Debugging-Looking in the wrong places
    By JaWiB in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-03-2003, 09:50 PM
  3. Confused: What is wrong with void??
    By Machewy in forum C++ Programming
    Replies: 19
    Last Post: 04-15-2003, 12:40 PM
  4. God
    By datainjector in forum A Brief History of Cprogramming.com
    Replies: 746
    Last Post: 12-22-2002, 11:01 AM
  5. Whats wrong?
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 07-14-2002, 01:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21