diff src/c-file-ptr-stream.cc @ 3652:25e84fcef38a

[project @ 2000-03-31 08:50:48 by jwe]
author jwe
date Fri, 31 Mar 2000 08:50:50 +0000
parents 9add655e8b8c
children 87fa55a09f19
line wrap: on
line diff
--- a/src/c-file-ptr-stream.cc
+++ b/src/c-file-ptr-stream.cc
@@ -44,8 +44,7 @@
 
 c_file_ptr_buf::~c_file_ptr_buf (void)
 {
-  if (f)
-    fflush (f);
+  flush ();
 }
 
 // XXX FIXME XXX -- I'm sure there is room for improvement here...
@@ -54,7 +53,7 @@
 c_file_ptr_buf::overflow (int c)
 {
   if (f)
-    return (c != EOF) ? fputc (c, f) : fflush (f);
+    return (c != EOF) ? fputc (c, f) : flush ();
   else
     return EOF;
 }
@@ -141,9 +140,38 @@
 int
 c_file_ptr_buf::sync (void)
 {
+  flush ();
+
   return 0;
 }
 
+int
+c_file_ptr_buf::flush (void)
+{
+  return f ? fflush (f) : EOF;
+}
+
+int
+c_file_ptr_buf::close (void)
+{
+  if (f)
+    return fclose (f);
+}
+
+void
+i_c_file_ptr_stream::close (void)
+{
+  if (buf)
+    buf->close ();
+}
+
+void
+o_c_file_ptr_stream::close (void)
+{
+  if (buf)
+    buf->close ();
+}
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***