Given the availability of an ifstream object named input, write the other statements necessary to read an integer into a variable datum that has already been declared from a file called rawdata.

Given the availability of an ifstream object named input, write the other statements necessary to read an integer into a variable datum that has already been declared from a file called rawdata.

LANGUAGE: C++

CHALLENGE:

Given the availability of an ifstream object named input, write the other statements necessary to read an integer into a variable datum that has already been declared from a file called rawdata.

Assume that reading that one integer is the only operation you will carry out with this file.

(Note: write just the statements, do not define a main function.)

SOLUTION:


input.open("rawdata");
input >> datum;
input.close();


Add comment