/* Title.cpp * * CSE 326, Spring 2000 * Program 1 * ** */ #include "Title.h" #define MAX_LINE 200 /* This method reads the title fields from input_file * and stores them in data members of class title. */ void title::readTitle(string input_file) { ifstream input(input_file.c_str()); string buffer; char temp[MAX_LINE]; if(input.is_open() == false){ cerr << "The input file cannot be opened.\n"; exit(1); } input >> buffer; if(buffer != "P2"){ cerr << "The format is incorrect.\n"; exit(1); } input >> buffer; while(buffer[0] == '#'){ input.getline(temp, MAX_LINE, '\n'); input >> buffer; } col = atoi(buffer.c_str()); input >> row; input >> max_value; input.close(); }