Home > front end >  C refusing to print debug info to console. Why?
C refusing to print debug info to console. Why?

Time:12-07

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.

CodePudding user response:

You need a \n at the end. There's no println unfortunately

CodePudding user response:

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

  • Related