following is a part of the code.
int width, height, brightness, counter;
std::ifstream ifs;
//initialize
width = height = brightness = counter = 0;
ifs.open(input_file_name, std::ios::in);
std::string filetype;
std::string filetype_str;
std::getline(ifs, filetype);
std::string size_str;
std::getline(ifs, size_str);
std::istringstream size_stream(size_str);
size_stream >> width >> height;
std::string brightness_str;
std::getline(ifs, brightness_str);
std::istringstream brightness_stream(brightness_str);
brightness_stream >> brightness;
std::string header_needless;
std::getline(ifs, header_needless);
std::cout << filetype << std::endl;
std::cout << width << std::endl;
std::cout << height << std::endl;
std::cout << brightness << std::endl;
this means there are 4 lines for a header.
0 件のコメント:
コメントを投稿