09.07.2015 Views

Standard Input/Output Library - University of Windsor

Standard Input/Output Library - University of Windsor

Standard Input/Output Library - University of Windsor

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

IntroductionStreams and FILE objectsBufferingOpening a StreamReading and writing a streamChanging the default bufferingFully buffered I/OLine buffered I/OUnbuffered I/OANSI C buffering requirementsChanging the default bufferingExamplesWe can change the default buffering using:void setbuf(FILE *fp, char *buf);If buf is NULL then, buffering is disabled.Otherwise, buf must point to a buffer <strong>of</strong> length BUFSIZ.void setvbuf(FILE *fp, char *buf, int mode,size t size);This function can specify which buffering we wantdepending on the value <strong>of</strong> mode:IOFBF: fully bufferedIOLBF: line bufferedIONBF: unbufferedNote that when an unbuffered stream is specified, the bufand size arguments are ignored.<strong>Standard</strong> <strong>Input</strong>/<strong>Output</strong> <strong>Library</strong>60-256 System Programming

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!