11.07.2015 Views

tYSR20

tYSR20

tYSR20

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.

Chapter 24: Using Stream I/O 321}return 0;int main(int nNumberofArgs, char* pszArgs[]){// get a file streamifstream* pFileStream = openFile(cin);// read blocks of data 80 bytes at a timechar buffer[80];while (!pFileStream->eof() && pFileStream->good()){// read a block - 80 is the max but gcount() returns// the actual number of bytes readpFileStream->read(buffer, 80);int noBytes = pFileStream->gcount();}// do something with the blockfor(int i = 0; i < noBytes; i++){cout

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

Saved successfully!

Ooh no, something went wrong!