Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Autosaving before building and consoles
Autosaving before building and consoles [message #1780365] Sun, 21 January 2018 15:45 Go to next message
Leonardo Benini is currently offline Leonardo BeniniFriend
Messages: 1
Registered: January 2018
Junior Member
Hi all,
I used DevC++ for a while, now that i switched to Eclipse i wonder if there is a way to build a project such that it automatically saves the file, then build/build-and-run it.
It's not a big deal to click one more button to run a project, but if there is a way to do it why not?

Question 2
Why does the built-in console kinda work differently from the cmd?
Explanation:
I write a simple program to say "Helll world!"
I use system("PAUSE") at the end to keep the window open(i do not use it anymore, i know it is bad, this problem doesn't happen now, i'm just curious about why it did)
If i end the string "Hello World!" with a <<endl both the cmd and the built in console work fine.
If i write "Hello world!\n" or simply "Hello World!" the cmd works fine (in the second case Press any key to continue is attached to world! obviously), but if i run it in the console it runs every instruction but the last(in this case it does nothing), then it writes "Press any key to continue" and then it outputs the string, why so?

Thanks
Re: Autosaving before building and consoles [message #1780579 is a reply to message #1780365] Wed, 24 January 2018 05:02 Go to previous message
David Vavra is currently offline David VavraFriend
Messages: 660
Registered: October 2012
Senior Member
You can enable autosave inn the Windows settings Window-->General-->Editors-->Autosave
https://stackoverflow.com/questions/2635951/eclipse-save-automatically'
I personally found this to be a nuisance.

---

stdout is buffered in some installations.
You can change this but it depends on how you are sending output.
for FILE* connections, use setvbuf http://www.cplusplus.com/reference/cstdio/setvbuf/
or use fflush http://www.cplusplus.com/reference/cstdio/fflush/

ostream is a bit more complicated
http://www.cplusplus.com/forum/beginner/140381/
https://www.gamedev.net/forums/topic/326029-option-to-make-ofstream-constantly-flush/
perhaps the easiest is to sync cut with stdio cout.sync_with_stdio(true)
or use cout.flush() when you want the ouput

The console interface between your program and Eclipse may also buffer.
As far as I know, you can't change it.


Previous Topic:How do I link MinGW C/C++ compiler to Eclipse
Next Topic:Remote debugging
Goto Forum:
  


Current Time: Wed Feb 21 08:12:32 GMT 2018

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

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