Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » I/O via (Eclipse-) console buggy
icon9.gif  I/O via (Eclipse-) console buggy [message #1759450] Tue, 11 April 2017 18:25 Go to next message
Ralf Steinhaeusser is currently offline Ralf SteinhaeusserFriend
Messages: 1
Registered: April 2017
Junior Member
Hey folks!
I just wanted to dive into C/C++ development and installed eclipse and mingw on my PC (Win7 64 bit).

When I do very simple things like
	printf("Please enter a number: ");
	char word[256];
	fgets(word, sizeof(word), stdin);

and I start the binary from the explorer, a command shell shows up and everything acts as it should, but when start the program from the IDE, nothing happens in the so called "interactive console".
I first have to enter something and then the text "Please enter..." appears (afterwards!).

Or this code:
	for (int i=0; i<5; i++) {
		Sleep(1000);
		int data = rand() % 6;
		printf("Val %d = %d\n", i, data);
	}

Doesn't show up until the program finishes. In the windows command shell it works.
Asking Google it appears that Eclipse redirects the console output and ,,, eerh, I didn't understand the rest.

I now tried Visual Studio, and they pop up a "normal" command shell, and everything works fine. Any chance to fix Eclipse on that (very basic) topic?

Thanks,
Ralf
Re: I/O via (Eclipse-) console buggy [message #1759535 is a reply to message #1759450] Wed, 12 April 2017 15:35 Go to previous message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
The console is buffered depending on the OS.
Do flush(stdout) when you want to see up-to-date output.
Previous Topic:console window of eclipse doesn´t display what I want
Next Topic:How to use CubeMX generated source code in Eclipse IDE
Goto Forum:
  


Current Time: Tue Mar 19 08:33:39 GMT 2024

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

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

Back to the top