Skip to main content



      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 14:43 Go to next message
Eclipse UserFriend
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 435 times)
  • Attachment: tre.jpg
    (Size: 141.06KB, Downloaded 1115 times)
  • Attachment: Immagine.png
    (Size: 76.47KB, Downloaded 1443 times)
  • Attachment: due.jpg
    (Size: 136.23KB, Downloaded 933 times)
Re: Problem with eclipse while running simple c program [message #1749451 is a reply to message #1749358] Tue, 06 December 2016 18:01 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 16:42:12 EDT 2025

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

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

Back to the top