From 0abf3a803af06eea827bf560d2758a9acd7646c3 Mon Sep 17 00:00:00 2001 From: speedie Date: Wed, 16 Aug 2023 08:10:33 +0200 Subject: [PATCH] Check to make sure we have an input file. --- mcopy.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mcopy.cpp b/mcopy.cpp index 0f0c865..4cb42c0 100644 --- a/mcopy.cpp +++ b/mcopy.cpp @@ -152,6 +152,11 @@ int main(int argc, char **argv) { exit(1); } + if (argc < 4) { + std::cout << "mcopy: You must specify a file to copy.\n"; + exit(1); + } + for (int i{1}; i < ac; i++) { std::ifstream f(av[i]);