fbuf: New data structure for buffered file I/O.
[pspp] / src / language / data-io / data-writer.c
index 65de635302e3fe2613bb04b72e49243ba06310e5..2e03218f69c287bcc418b5d13c6864e4ccd77791 100644 (file)
@@ -92,7 +92,7 @@ dfm_open_writer (struct file_handle *fh, const char *encoding)
   w = xmalloc (sizeof *w);
   w->fh = fh_ref (fh);
   w->lock = lock;
-  w->rf = replace_file_start (w->fh, "wb", 0666, &w->file);
+  w->rf = replace_file_start (w->fh, true, 0666, &w->file);
   w->encoding = xstrdup (encoding);
   w->line_ends = fh_get_line_ends (fh);
   w->unit = ei.unit;
@@ -218,7 +218,7 @@ dfm_close_writer (struct dfm_writer *w)
   if (w->file != NULL)
     {
       const char *file_name = fh_get_file_name (w->fh);
-      ok = !dfm_write_error (w) && !fn_close (file_name, w->file);
+      ok = !dfm_write_error (w) && !fn_close (w->fh, w->file);
 
       if (!ok)
         msg (ME, _("I/O error occurred writing data file `%s'."), file_name);