Skip to content

Instantly share code, notes, and snippets.

@mostsignificant
Created October 18, 2021 23:38
Show Gist options
  • Save mostsignificant/6ef439cdd7698a244119760637adc6be to your computer and use it in GitHub Desktop.
Save mostsignificant/6ef439cdd7698a244119760637adc6be to your computer and use it in GitHub Desktop.
blog-file-name-loop
for (const auto &file_name : program_options::input_files()) {
std::ifstream input_file(file_name, std::ios::in);
// ...
while (std::getline(input_file, line)) {
if (program_options::show_line_numbers())
std::cout << std::setw(6) << std::setfill(' ') << line_count++ << " ";
// ...
if (program_options::show_ends())
std::cout << '$';
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment