added a check for files opened for writing.
authorMilind Bhandarkar <milind@cs.uiuc.edu>
Tue, 10 Dec 1996 18:55:11 +0000 (18:55 +0000)
committerMilind Bhandarkar <milind@cs.uiuc.edu>
Tue, 10 Dec 1996 18:55:11 +0000 (18:55 +0000)
src/xlat-i/xi-generate.C

index e8964d7b31a0c6ee96ec61005026c986e5793d31..f1f14478928aa46e436607003ddbd1c5ddfc4025 100644 (file)
@@ -28,6 +28,12 @@ void Generate(char *interfacefile)
 
   ofstream top(topname), bot(botname) ;
 
+  if (top == 0 || bot == 0) {
+    cerr << "Cannot open " << topname 
+         << " or " << botname << " for writing !!" << endl;
+    exit(1);
+  }
+
   sprintf(definename, "CI_%s_TOP_H", thismodule->name);
   top << "#ifndef " << definename << "\n#define " << definename << endl;
   sprintf(definename, "CI_%s_BOT_H", thismodule->name);