hi all,
when fflush function must be called? and why?
thanks
baumann@pan 5 2180
On 31 May 2005 19:39:07 -0700, "baumann@pa n" <ba*********@gm ail.com>
wrote in comp.lang.c: hi all,
when fflush function must be called? and why?
thanks
baumann@pan
fflush(), or a file positioning function, must be called after writing
to a file opened in append mode before reading from the file. But the
fseek() or fsetpos() could be used as well, and indeed must be used
after reading from a file opened in append mode before writing to it.
There is no situation where the fflush() function must be called at
all.
There are cases where it is advisable to do so. The most particular
one is if a prompt that does not end in a '\n' is sent to the standard
output prompting for user input. On some systems, the prompt may not
appear on the terminal or display until after the user ends his input
with the 'enter' or 'return' key, unless you fflush() stdout before
calling the input function on stdin.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.l earn.c-c++ http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
baumann@pan wrote: hi all,
when fflush function must be called? and why?
thanks
baumann@pan
A simple (and incomplete) explanation:
fflush will write all pending output to its file immediately.
Since it's a quite costly operation the standard library output
functions does not do this by default.
-- August
On 31 May 2005 19:39:07 -0700, in comp.lang.c , "baumann@pa n"
<ba*********@gm ail.com> wrote: when fflush function must be called? and why?
When you want to flush output.
Because you want to flush output.
( This is a homework question, right? )
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt >
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Mark McIntyre wrote: On 31 May 2005 19:39:07 -0700, in comp.lang.c , "baumann@pa n" <ba*********@gm ail.com> wrote:
when fflush function must be called? and why? When you want to flush output. Because you want to flush output.
( This is a homework question, right? )
no, i just wonder
why printf("abcd"); may not work properly.
but printf("abcd\n" ); would work.
and i remember in some post someone wrote when fflush must be needed.
but i have not write it down, so i can not remember it.
-- Mark McIntyre CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html> CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt >
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
thank u, yours is most in details, thanks much.
Jack Klein wrote: On 31 May 2005 19:39:07 -0700, "baumann@pa n" <ba*********@gm ail.com> wrote in comp.lang.c:
hi all,
when fflush function must be called? and why?
thanks
baumann@pan
fflush(), or a file positioning function, must be called after writing to a file opened in append mode before reading from the file. But the fseek() or fsetpos() could be used as well, and indeed must be used after reading from a file opened in append mode before writing to it.
There is no situation where the fflush() function must be called at all.
There are cases where it is advisable to do so. The most particular one is if a prompt that does not end in a '\n' is sent to the standard output prompting for user input. On some systems, the prompt may not appear on the terminal or display until after the user ends his input with the 'enter' or 'return' key, unless you fflush() stdout before calling the input function on stdin.
-- Jack Klein Home: http://JK-Technology.Com FAQs for comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html comp.lang.c++ http://www.parashift.com/c++-faq-lite/ alt.comp.lang.l earn.c-c++ http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Nigel T |
last post by:
Hi,
I have a form containing controls, a timer, and the EventLog component.
I also create some new instances of classes that do not implement idisposable
I don't want to leave the tidying up to the GC so...
Do I need to explicitly call EventLog.dispose() as in the following snippet?
protected overloads sub dispose(byval disposing as boolean)
if disposing
if components is nothing then
components.dispose
|
by: Zheng Da |
last post by:
Program received signal SIGSEGV, Segmentation fault.
0x40093343 in _int_malloc () from /lib/tls/libc.so.6
(gdb) bt
#0 0x40093343 in _int_malloc () from /lib/tls/libc.so.6
#1 0x40094c54 in malloc () from /lib/tls/libc.so.6
It's really strange; I just call malloc() like "tmp=malloc(size);"
the system gives me Segmentation fault
I want to write a code to do like a dynamic array, and the code is as
|
by: John |
last post by:
Hi all,
This really is quite an urgent matter.
I have a page with multiple, dynamically-loaded user controls and when a
user clicks on a button, the whole form is submitted. Now at this stage I
know I need to call a function that will save data but I'm not sure exactly
when to call this function.
I've tried two ways and both seem to have 'gotcha's':
|
by: Zhihong Yu |
last post by:
Hi,
I declare an API as following:
Public Declare Function IsFirstInstance Lib "WPLink.dll" () As Integer
When I call this function in Main(), I got System.DllNotFoundException
even though WPLink.dll is copied alongside .Net program or under
<system32>.
Your help is appreciated.
*** Sent via Developersdex http://www.developersdex.com ***
|
by: Brett |
last post by:
What are the cases in which the .NET framework must be installed on the
client machine?
Are there any setup programs that will do this or how is it usually done?
From what I understand, a .NET program (EXE) can just be copied to another
machine. I suppose that machine must have .NET however.
Thanks,
Brett
| |
by: karlag92 |
last post by:
Using .Net 1.1, in our Windows Forms Application we were taking
advantage of the async functionality that is auto generated by c# for
Web Service calls.
We were doing it almost exactly like the first example here:
http://msdn2.microsoft.com/en-us/library/55xs7d7f(VS.71).aspx
Out WebMethod however had a definition like something like this:
|
by: pepper |
last post by:
I'm confused about why i get a type error when i call an object's
method. Here's the example code:
def __init__(self):
self.foo =
def foo(self):
print "in foo!"
|
by: Sep410 |
last post by:
Hi all,
Is there any way I can show all the value (String) of the datagridview cell in one cell without any need to scroll.
I mean is there any way datagrid cell increase the cell height automatically when the cell value is more than actual size. Something like multiline when it is needed.
|
by: bamusic |
last post by:
I am trying to run a programme which is using PGPLOT.When I call it from browser I get following error message.
--------
%PGPLOT, Unable to read font file: grfont.dat %PGPLOT, Use environment variable PGPLOT_FONT to specify the location of the PGPLOT grfont.dat file. %PGPLOT, PGENV: no graphics device has been selected %PGPLOT, PGBBUF: no graphics device has been selected %PGPLOT, PGMTXT: no graphics device has been selected %PGPLOT, PGMTXT:...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |