Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 5th, 2006, 9:56 AM   #11
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Quote:
Originally Posted by Xyhm
I've had problems with printf writing to the screen and not flushing afterwards. As for '\n', I've read somewhere that it makes flushing in these cases unnecessary, but I don't know why and it may very well not be true.
Like I said, it's true for std::endl, not for a newline character ('\n'). Strange that you had problems with that. Must have been something else. Or like DaWei said, mixing printf with cout.

@David: Thanx for clearing that up for me.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old Apr 5th, 2006, 11:14 AM   #12
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Quote:
I've had problems with printf writing to the screen and not flushing afterwards.
Quote:
The function fflush forces a write of all buffered data
for the given output or update stream via the stream's
underlying write function. The open status of the stream
is unaffected.
If printf "wrote to the screen" the contents written aren't there to flush. Unwritten contents might be. If your system wrote to the output device and the data remained in the buffer (well, the pointer didn't reflect the output), then you have a fairly serious failure. This would be unlikely on a normal, off-the-shelf system such as most people deal with. I would suggest you garner as much information as possible by examining the file pointer structure if you find this to be a real problem.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Apr 6th, 2006, 6:57 PM   #13
bl00dninja
Programming Guru
 
bl00dninja's Avatar
 
Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 5 bl00dninja is on a distinguished road
i like the fact that the letter 'o' seems to equal zero here.
__________________
i put on my robe and wizard hat...

Have you ever heard of Plato, Aristotle, Socrates?...Morons.
bl00dninja is offline   Reply With Quote
Old Apr 8th, 2006, 9:54 PM   #14
Xyhm
Programmer
 
Xyhm's Avatar
 
Join Date: Mar 2006
Posts: 60
Rep Power: 3 Xyhm is on a distinguished road
Quote:
Originally Posted by DaWei
If printf "wrote to the screen" the contents written aren't there to flush. Unwritten contents might be. If your system wrote to the output device and the data remained in the buffer (well, the pointer didn't reflect the output), then you have a fairly serious failure. This would be unlikely on a normal, off-the-shelf system such as most people deal with. I would suggest you garner as much information as possible by examining the file pointer structure if you find this to be a real problem.
I will, and it appears I also have some stuff to learn about this whole flushing thing. Thanks for the info.
Xyhm is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:55 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC