]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/midi-stream.cc
2003 -> 2004
[lilypond.git] / lily / midi-stream.cc
index 221658a71dc62f3eeab485dd2fb6ef87751b3781..e5c760e7c07dc8e62dffd8dd22509a4d92027d72 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--2003 Jan Nieuwenhuizen <janneke@gnu.org>
+  (c) 1997--2004 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
 
@@ -31,17 +31,14 @@ Midi_stream::~Midi_stream ()
 Midi_stream&
 Midi_stream::operator << (String str)
 {
-  Byte *b = str.get_bytes ();
-#if 0
-  for (int sz = str.length (); sz--;)
-    {
-      fputc (*b, out_file_);
-      b++;
-    }
-#else
-  for (int i = 0, n = str.length (); i < n; i++)
-    fputc (b[i], out_file_);
-#endif
+  size_t sz = sizeof (Byte);
+  size_t n = str.length ();
+  size_t written = fwrite (str.get_bytes (),
+                          sz, n, out_file_);
+
+  if (written != sz * n)
+    warning (_ ("Could not write file. Disk full?"));
+
   return *this;
 }