home *** CD-ROM | disk | FTP | other *** search
/ C by Discovery (4th Edition) / C_By_Discovery_4th_Edition.tar / C_By_Discovery_4th_Edition / CH_12 / 750.jpg < prev    next >
Joint Photographic Experts Group Image  |  2013-12-13  |  511KB  |  2550x3300
Labels: book | crt screen | monitor | poster | reckoner | screen | sky
OCR: 750 Chapter Discovering C++ Example 12-25: filel.cpp filel cpp Synopsis Opens an ifstream object (an input file) and an ofstream 1qo ect (an output file) and copies the input the output file. Obj jective To introduce file handl ing //Inc iude Files #incl ude iostream h> #inc lude <fs tream h> Note #inc lude <stdlib.h> int main) ifstream infile(" info"; Note 2 !infile Note3 cerr info couldn be opened\n exit1 ofstream outfile; Note outfile. .open "copy"; Note i f !out file Note cerr "copy couldn t be Opened\n" exit char c whil le infile get(c) Note outfiie put (c Note infile close Note outfile. C lose Note return This program consists ofa single function main An istream object named infi opened An ostream object named outfile is opened. Then infile copied to outfile Obiective couldnt exit2 w ...