Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Problem with eclipse while running simple c program
Problem with eclipse while running simple c program [message #1749358] Mon, 05 December 2016 19:43 Go to next message
Cosimo Argentino is currently offline Cosimo ArgentinoFriend
Messages: 3
Registered: December 2016
Junior Member
index.php/fa/27781/0/Hi everybody, I'm new in this forum and I installed eclipse with minGW for my university's exam.
I was writing a simple c program to test eclipse installation and I noticed a big problem. There is a screen:
index.php/fa/27781/0/

On the console output It seems to run first the last line of the code (the acquisition of the number) and then the first printf with "Inserisci il numero" ("Write the number" in english)

If I go in the debug folder and I run the .exe, the program works perfectly.

Just for another exemple, with this program after saved and debugged, if i run the console the first printf does not appear until i insert a number
index.php/fa/27780/0/
index.php/fa/27782/0/

I insert the number (5), then the program start the system pause and in the end the program start the first printf and the last.

Also for this program, if I run the exe from the debug folder, the program works perfectly.

I need a working eclipse program for my exam in jenuary, please help me and sorry for my bad english.
index.php/fa/27782/0/
  • Attachment: uno.png
    (Size: 68.12KB, Downloaded 295 times)
  • Attachment: tre.jpg
    (Size: 141.06KB, Downloaded 703 times)
  • Attachment: Immagine.png
    (Size: 76.47KB, Downloaded 980 times)
  • Attachment: due.jpg
    (Size: 136.23KB, Downloaded 567 times)
Re: Problem with eclipse while running simple c program [message #1749451 is a reply to message #1749358] Tue, 06 December 2016 23:01 Go to previous message
Jonah Graham is currently offline Jonah GrahamFriend
Messages: 404
Registered: June 2014
Senior Member
Hi Cosimo,

Welcome to the world of buffering Smile All of this is behaving as designed, once you know that the embedded console in Eclipse is not a terminal. By not a terminal it means that isatty or platform equivalent returns false. This causes the standard C library to change how stdout (used by printf) is buffered. Read more about it, perhaps start with this SO Q&A: http://stackoverflow.com/questions/3723795/is-stdout-line-buffered-unbuffered-or-indeterminate-by-default

Alternatively, you can experiment by removing the \n on your first printf, you should then also see "strange" buffering when operating at the command line.

Jonah
Previous Topic:How to reset running program?
Next Topic:Problems while running a simple c program on eclipse
Goto Forum:
  


Current Time: Tue Jan 25 20:44:39 GMT 2022

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

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

Back to the top