Thread: Problem Executing Programs

  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    132

    Problem Executing Programs

    Hi, everyone. I'm having a problem on my computer, a problem that hadn't happened since I started compiling programs in C, at least from what I remember. I use Windows XP and the Open Watcom compiler, and some of my programs aren't doing anything when executed - for example, one of them, shown below, doesn't actually print anything:

    Code:
    /* New1.c */
    
    #include <stdio.h>
    
    int main(void)
    {
        printf("ABC\n");
        
        return 0;
    }
    This program compiles successfully, with no error nor warnings - however, when executed, nothing happens.

    Does anybody know what could be happening? Some hours ago I wrote and executed a program which used pointers to FILE - is it possible that it may be related to the problem? I even uninstalled and reinstalled the compiler, but the problem is still present.

    Thanks in advance!

  2. #2
    Ultraviolence Connoisseur
    Join Date
    Mar 2004
    Posts
    555
    I would guess either the program is running so fast you don't see anything happening (it will print to a dos window if anything, which will immediately close. You can easily check this by simply putting a getchar(); call after the printf() statement) OR your compiler is outputting to some "pane" or other hidden/tabbed window that you aren't viewing.

  3. #3
    Registered User
    Join Date
    Jan 2013
    Posts
    2
    put getch() function at the end of code

  4. #4
    Ultraviolence Connoisseur
    Join Date
    Mar 2004
    Posts
    555
    Quote Originally Posted by sunil pandey View Post
    put getch() function at the end of code
    getch() is non-standard and completely pointless for something as simple as halting execution pending user input.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Executing programs in your PATH
    By Sfel in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2008, 05:14 AM
  2. Please Help Me! Executing Problem
    By hattourie in forum C Programming
    Replies: 1
    Last Post: 11-05-2007, 04:04 AM
  3. Replies: 40
    Last Post: 09-01-2006, 12:09 AM
  4. Problem executing sample program:
    By mrabiu in forum C++ Programming
    Replies: 4
    Last Post: 03-13-2004, 06:44 PM
  5. executing c++ programs on the web
    By gulti01 in forum C++ Programming
    Replies: 4
    Last Post: 08-12-2002, 03:12 AM