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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Example...IntroductionStreams and FILE objectsBufferingOpening a StreamReading and writing a stream#include int main(int argc, char *argv[]){FILE *fd;char ch;int fileSize=-1;}fd = fopen(argv[1], "r");do{ch=getc(fd);fileSize++;} while( ch != EOF);printf("Size <strong>of</strong> %s is %d\n", argv[1], fileSize);./size size.c → Size <strong>of</strong> size.c is 242 (correct size)<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!