From f0b3a15f91caa5ed704d80ee25e3e1db8993b872 Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Fri, 18 Jul 2025 16:12:07 +0200 Subject: [PATCH] Fix multiple file args With multiple files, you would get a line for each file argument, but only from the first file, never from any other file argument. --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 41b5131..526edbd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -70,7 +70,7 @@ int main(int argc, char* argv[]) { for (int i = optind; i < argc; ++i) { try { // process file argv[i] - ifstream infile {argv[1]}; + ifstream infile {argv[i]}; cout << random_line_from_file(infile) << '\n'; } catch (const runtime_error& ex) { cerr << "ranlin: " << ex.what() << '\n';