lect09 Files

lect09 Files - Announcements Quiz 2 grades posted on...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Announcements Quiz 2 grades posted on blackboard Current average: 36 (72%)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Files Data in Main Memory is “volatile” File: Place for “permanent” data storage C: drive, A: drive, Flash drive, etc.
Background image of page 2
Output File Streams In C++, the Programmer Can Declare Output Streams #include <iostream> #include <fstream> using namespace std; ofstream outputStream; //ofstream object int num1, num2, num3; cout << “Enter 3 Numbers for datafile: “; cin >> num1 >> num2 >> num3; outputStream.open(“datafile.txt”); outputStream << num1 << “ “; outputStream << num2 << “ “; outputStream << num3; outputStream.close();
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Input File Streams In C++, the Programmer Can Declare Input Streams #include <iostream> #include <fstream> using namespace std; ifstream inputStream; //ifstream object int num1, num2, num3; inputStream.open(“datafile.txt”); inputStream >> num1 >> num2 >> num3; inputStream.close();
Background image of page 4
To Read or Write from a File Declare the File Stream Object Name
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 8

lect09 Files - Announcements Quiz 2 grades posted on...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online