Index: libcfa/src/fstream.cfa
===================================================================
--- libcfa/src/fstream.cfa	(revision 030653ad4ac632a77c528b1b8908e3fc50349440)
+++ libcfa/src/fstream.cfa	(revision 91e52be0d8a1dc5a70a53c5ef8cf2d526d590eba)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Feb  7 19:01:01 2020
-// Update Count     : 363
+// Last Modified On : Thu Jun 18 15:37:21 2020
+// Update Count     : 380
 //
 
@@ -123,4 +123,5 @@
 	#ifdef __CFA_DEBUG__
 	if ( file == 0p ) {
+		throw (IO_OPEN_FAILURE){ os };
 		abort | IO_MSG "open output file \"" | name | "\"" | nl | strerror( errno );
 	} // if
@@ -134,9 +135,11 @@
 
 void close( ofstream & os ) {
-	if ( (FILE *)(os.$file) == stdout || (FILE *)(os.$file) == stderr ) return;
+  if ( (FILE *)(os.$file) == 0p ) return;
+  if ( (FILE *)(os.$file) == (FILE *)stdout || (FILE *)(os.$file) == (FILE *)stderr ) return;
 
 	if ( fclose( (FILE *)(os.$file) ) == EOF ) {
 		abort | IO_MSG "close output" | nl | strerror( errno );
 	} // if
+	os.$file = 0p;
 } // close
 
@@ -219,4 +222,5 @@
 	#ifdef __CFA_DEBUG__
 	if ( file == 0p ) {
+		throw (IO_OPEN_FAILURE){ is };
 		abort | IO_MSG "open input file \"" | name | "\"" | nl | strerror( errno );
 	} // if
@@ -230,9 +234,11 @@
 
 void close( ifstream & is ) {
-	if ( (FILE *)(is.$file) == stdin ) return;
+  if ( (FILE *)(is.$file) == 0p ) return;
+  if ( (FILE *)(is.$file) == (FILE *)stdin ) return;
 
 	if ( fclose( (FILE *)(is.$file) ) == EOF ) {
 		abort | IO_MSG "close input" | nl | strerror( errno );
 	} // if
+	is.$file = 0p;
 } // close
 
@@ -276,4 +282,27 @@
 ifstream & sin = sinFile, & stdin = sinFile;
 
+
+//*********************************** exceptions ***********************************
+
+
+void ?{}( IO_OPEN_FAILURE & this, ofstream & ostream ) {
+	VTABLE_INIT(this, IO_OPEN_FAILURE);
+	this.ostream = &ostream;
+}
+void ?{}( IO_OPEN_FAILURE & this, ifstream & istream ) {
+	VTABLE_INIT(this, IO_OPEN_FAILURE);
+	this.istream = &istream;
+}
+const char * IO_OPEN_FAILURE_msg(IO_OPEN_FAILURE * this) {
+	return "IO_OPEN_FAILURE";
+}
+VTABLE_INSTANCE(IO_OPEN_FAILURE)(IO_OPEN_FAILURE_msg);
+void throwIO_OPEN_FAILURE( ofstream & ostream ) {
+	IO_OPEN_FAILURE exc = { ostream };
+}
+void throwIO_OPEN_FAILURE( ifstream & istream ) {
+	IO_OPEN_FAILURE exc = { istream };
+}
+
 // Local Variables: //
 // tab-width: 4 //
Index: libcfa/src/fstream.hfa
===================================================================
--- libcfa/src/fstream.hfa	(revision 030653ad4ac632a77c528b1b8908e3fc50349440)
+++ libcfa/src/fstream.hfa	(revision 91e52be0d8a1dc5a70a53c5ef8cf2d526d590eba)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Feb 17 08:29:23 2020
-// Update Count     : 175
+// Last Modified On : Tue Jun 16 20:41:21 2020
+// Update Count     : 184
 //
 
@@ -17,4 +17,5 @@
 
 #include "iostream.hfa"
+#include <exception.hfa>
 
 
@@ -106,4 +107,18 @@
 extern ifstream & sin, & stdin;							// aliases
 
+
+//*********************************** exceptions ***********************************
+
+
+DATA_EXCEPTION(IO_OPEN_FAILURE)(
+	union {
+		ofstream * ostream;
+		ifstream * istream;
+	};
+);
+
+void ?{}( IO_OPEN_FAILURE & this, ofstream & ostream );
+void ?{}( IO_OPEN_FAILURE & this, ifstream & istream );
+
 // Local Variables: //
 // mode: c //
