Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Black screen
Black screen [message #139133] Sat, 19 February 2005 17:17 Go to next message
Eclipse UserFriend
Originally posted by: rob.nw2.info

Just started programming in C using Eclipse

Prog =

#include <stdio.h>

int main(void)
{
int magic =123 ;
int guess;

printf("Enter your guess: ");
scanf("%d", &guess);

if(guess == magic) printf("** Right **");

return 0;
}

When I run it - I get a black screen and nothing else;

Press Ctrl+C and get returned to eclipse with
Enter your guess : in the console screen but progeam has terminated.

Anyone have any ideas?

Rob.
Re: Black screen [message #139146 is a reply to message #139133] Sat, 19 February 2005 19:22 Go to previous messageGo to next message
Eclipse UserFriend
Hi Rob,

Rob wrote:
> Just started programming in C using Eclipse
>
> Prog =
>
> #include <stdio.h>
>
> int main(void)
> {
> int magic =123 ;
> int guess;
>
> printf("Enter your guess: ");
> scanf("%d", &guess);
>
> if(guess == magic) printf("** Right **");
>
> return 0;
> }
>
> When I run it - I get a black screen and nothing else;

Either add fflush(stdout) after each printf or have them print a
newline. Stdout is usually line buffered; you can also change the
buffering strategy to "unbuffered" but it would nonsensically complicate
your simple application. Anyway, check function setvbuf if you're curious.

Cheers,
Re: Black screen [message #139169 is a reply to message #139146] Sun, 20 February 2005 15:34 Go to previous message
Eclipse UserFriend
Originally posted by: rob.nw2.info

Tried your solution Javier but no luck.

It's to do with the way my machine invokes .exe files.

instead of running them in a window - I'm getting a full screen,
but my system creates a screen to large for my monitor settings.

I navigated to my compiled program, created a shortcut for it and set the
option to run it within a window ... then it runs fine.

This is going to be a bit of a chore though if I have to do this for every
program!

Thanks,
Rob.
Previous Topic:Eclipse remote debugging
Next Topic:why I can not debug helloworld
Goto Forum:
  


Current Time: Sun Jul 27 11:19:16 EDT 2025

Powered by FUDForum. Page generated in 0.02855 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top