Re: C Interview Questions



Richard Heathfield wrote:
dhruvaraj@xxxxxxxxx said:

6. .Identify the correct argument for the function call fflush() in ANSI C:

None of the candidate answers is uniquely correct. Three are wrong, and stdout is only /one/ correct argument for fflush.

Richard, could you tell me why all three are wrong. I thought stdin, stdout, stderr where all macros to FILE * for the 3 streams. Now the standard does say for buffered streams, are they not buffered?

Also the standard says you can pass NULL to fflush to flush all open streams.

Thanks

Adrian
.



Relevant Pages

  • Re: C Interview Questions
    ... Richard Heathfield wrote: ... streams. ... argument to fflush. ... That's how English works. ...
    (comp.lang.c)
  • Re: C Interview Questions
    ... Richard Heathfield wrote: ... streams. ... which is another reason that there is no such thing as *the* ... which is the correct argument to fflush? ...
    (comp.lang.c)
  • Re: fflush(stdout);
    ... the fflush does not add anything. ... any terminal partial line on text streams. ... it releases the current contents of the output buffer to the system ... also trigger the necessary flushing. ...
    (comp.lang.c)
  • Re: how truncate a file in C?
    ... > FC> fflush() guarantees nothing here. ... > fflushshall cause any unwritten data for that stream to be written ... for defined interaction between stdio streams and file descriptors, ...
    (comp.unix.programmer)
  • Re: scanf behaviour
    ... Richard Heathfield wrote: ... U haven't provided any reference for your claim that fflush(stdin) is ... If stream points to an output stream or an update stream in which ...
    (comp.lang.c)