Thread: Why is my program running away?

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    2

    Why is my program running away?

    Hi.. I'm new, so be nice

    I have 2 problems that have been giving me nightmares and was wondering if anyone would be kind enough to help.

    #1: I installed CYGWIN on my laptop and it seems to work ok but I can't figure out a way to RUN the program. I have tried *Everything* I can think of but it doesn't want to run... Please, help?

    And
    #2: To kinda solve #1 I went out an bought Borland 5.02 Starter Kit because I thought it be easier.. Well that one works good up until I want to run the program then the black msdos window flashes on my screen. I cannot read the output and this is very very bad. (Midterm Friday.. Uh-oh) It's like my computer is too fast for it's own good. (See, program running away.... *sniff* Nobody likes me.)

    Will some kind soul please help me? I will be forever in your debt if you can solve my dilemas... Thanks so Much!

    ~Lynnzee *Meow*

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    164
    Put a 'cin >> variable' or something at the end of your program so it isn't exited until you have read the output.
    // Gliptic

  3. #3
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    (I know this method is old-fasioned, but this way works the best or me). If you want to just pause the program untill the user enters a key without having to declare another variable ect, just place the follwing code at the very end of your program. But make sure you include stdio.h

    Code:
    system("pause");

  4. #4
    Registered User kitten's Avatar
    Join Date
    Aug 2001
    Posts
    109
    With borland compiler (and many other) I think
    Code:
    getch();  // reads one keyhit from keyboards
    is the best solution.
    Making error is human, but for messing things thoroughly it takes a computer

  5. #5
    Registered User
    Join Date
    Sep 2001
    Posts
    3

    I had a similar problem

    When I ran my source with Dev-C++ I was suppose to be able to name the executable but it didn't let me do that. It would just run (tell me I had 0 errors) and flash the MSDOS window and go away. It did save an executable with the same name as my source in the same folder though. So I just opened MSDOS and ran the executable from there. It wont work if I just double click on the icon.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 10
    Last Post: 04-07-2008, 09:14 AM
  2. Program running long
    By smarta_982002 in forum Windows Programming
    Replies: 3
    Last Post: 03-27-2008, 05:24 AM
  3. Running my program in the background
    By shoobsie in forum Windows Programming
    Replies: 4
    Last Post: 10-09-2005, 02:38 AM
  4. Replies: 3
    Last Post: 09-05-2005, 08:57 AM
  5. Running program
    By muffin in forum C Programming
    Replies: 5
    Last Post: 08-30-2001, 10:57 AM