From 9ae01cdc6716ac43eeddb36e3e61e5c964b2c900 Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Wed, 16 Mar 2022 16:32:04 +0200 Subject: Update array_of_students_read.cpp --- Sem. 03/array_of_students_read.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Sem. 03/array_of_students_read.cpp') diff --git a/Sem. 03/array_of_students_read.cpp b/Sem. 03/array_of_students_read.cpp index 655b38c..bd1a935 100644 --- a/Sem. 03/array_of_students_read.cpp +++ b/Sem. 03/array_of_students_read.cpp @@ -34,6 +34,13 @@ int main() Student* arr; size_t count; ifstream file("students.dat"); + + if(!file.is_open()) + { + std::cout << "Error while opening the file!" << std::endl; + return -1; + } + readFromFile(arr, count, file); for (int i = 0; i < count; i++) -- cgit v1.3.1-23-gd82d