// lab3IOsamples.cpp // Lab 3: Program written by Lucia Moura // This is a program to test several methods of reading and writing #include #include #include using namespace std; int main() { fstream file; unsigned int i; char c; long int num1,num2, num3; char Cstring[200]; // In each of the following sections, we read information // from the same file using different methods. // Try to guess the outcome before running the program. cout<<"Session 1 using get(char):\n"; file.open("lowcomp1.txt",ios::in); file.get(c); cout<<"Read:"<>num' 3 times:\n"; file.open("lowcomp1.txt",ios::in); file>>num1; cout<<"Read:`"<>num2; cout<<"Read:`"<>num3; cout<<"Read:`"< (&x), sizeof(long int)); outfile.write(reinterpret_cast (&y), sizeof(short int)); outfile.close(); cout<<"Created outfilebin.txt. How many bytes are there in the file?\n"; return 0; }