From 4a044b56af46b7bd6b4a2c8be5716910659c9875 Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Wed, 16 Mar 2022 16:31:28 +0200 Subject: Update array_of_students_write.cpp --- Sem. 03/array_of_students_write.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Sem. 03/array_of_students_write.cpp b/Sem. 03/array_of_students_write.cpp index 3802bf8..c356a28 100644 --- a/Sem. 03/array_of_students_write.cpp +++ b/Sem. 03/array_of_students_write.cpp @@ -32,7 +32,15 @@ int main() initStudent(arr[3], "katerina", 19, 12134); ofstream file("students.dat", ios::binary); + + if(!file.is_open()) + { + std::cout << "Error while opening the file!" << std::endl; + delete[] arr; //! + return -1; + } + saveToFile(arr, 4, file); delete[] arr; -} \ No newline at end of file +} -- cgit v1.3.1-23-gd82d