Week 5

File I/O with integers: Ch. 5 continued

File input and output: the ability to read and write to file(s). Files can be used to save and store data for later use. ex: word processors, image editors, spreadsheets, games, web browswers, system settings, etc.

-Input File Stream (Read)

- ifstream fin;

- fin.open("input_file.txt");

- fin.fail();

- fin >> readValue;

- fin.close();

-Output File Stream (Write)

- ofstream fout;

- fout.open("output_file.txt");

- fout.fail();

- fout << outputVar << "output string\n";

- fout.close();

-Nested Loops