cloopsdebuggingdo-while

C refusing to print debug info to console. Why?


My C code only prints the printf statement if I get rid of my loop. I have tried using regular while loops instead of a dowhile loop but it doesn't work. Anyone know?

/**
 * Src for Planet Miner: Endless Space
*/

const char version[] = "a0.1_0";

#include <stdio.h>
#include <stdlib.h>

int main()
{
    printf("Starting game... version %s", version);

    int gameRunning = 1;

    do {
        //printf("O"); debugging is fun!
    }
    while (gameRunning == 1); // Main game loop

    return 0; // End program after main loop
}

Would anyone kindly help?

I have tried using regular while loops instead of a do-while loop. However, it didn't want to print it out to the console.


Solution

  • printf("0"); fflush(stdout); will solve your problem.