source file of the GNU LilyPond music typesetter
- (c) 1997--2003 Jan Nieuwenhuizen <janneke@gnu.org>
+ (c) 1997--2004 Jan Nieuwenhuizen <janneke@gnu.org>
*/
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;
}