]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/text-stream.cc
release: 1.5.36
[lilypond.git] / flower / text-stream.cc
index 737b41196075b6487944aa75f4097e46b486a4b3..e6a1202a14769970432b83edced5768433eba07b 100644 (file)
@@ -1,8 +1,10 @@
+#include <stdlib.h>
+#include <iostream.h>
 #include "text-stream.hh"
 
 Text_stream::Text_stream (String fn)
 {
-  ios::sync_with_stdio();
+  ios::sync_with_stdio ();
   if (fn == "")
     {
       name = _ ("<stdin>");
@@ -18,7 +20,7 @@ Text_stream::Text_stream (String fn)
   if (!f)
     {
       cerr << __FUNCTION__ 
-          << ": " << _f ("Can't open file: `%s'", fn) << '\n';
+          << ": " << _f ("can't open file: `%s'", fn) << '\n';
       exit (1);
     }
 
@@ -28,7 +30,7 @@ Text_stream::Text_stream (String fn)
 void
 Text_stream::message (String s)
 {
-  cerr << '\n'<<get_name() << ": " << line ()<<": "<<s<<endl;
+  cerr << '\n'<<get_name () << ": " << line ()<<": "<<s<<endl;
 }
 
 bool
@@ -39,3 +41,11 @@ Text_stream::eof_b ()
       // !pushback.size () && 
       feof (f);
 }
+
+Text_stream::~Text_stream ()
+{
+    if (!eof_b ()) 
+      cerr <<__FUNCTION__<< ": closing unended file";
+    
+    fclose (f);
+  }