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 streamNote that these 3 functions return -1 whether an error or theend-<strong>of</strong>-file occurs.How to differentiate between the 2 situations?For each stream, two flags are maintained in the FILE object:an error flag and an end-<strong>of</strong>-file flag.The following three functions should be used to access theseflags:int ferror(FILE*)returns nonzero for true, 0 otherwiseint fe<strong>of</strong>(FILE*)returns nonzero for true, 0 otherwisevoid clearerr(FILE*)clears both the error and the end-<strong>of</strong>-file flags.<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!