/* $Id$ */
-#include <fstream>
#include <iostream>
#include <msp/core/application.h>
#include <msp/core/getopt.h>
+#include <msp/io/buffered.h>
+#include <msp/io/file.h>
#include "source/parser.h"
#include "source/statement.h"
#include "source/writer.h"
int DataTool::main()
{
- istream *in;
+ IO::Base *in;
if(in_fn=="-")
- in=&cin;
+ throw Exception("stdin/out not supported at the moment");
else
- in=new ifstream(in_fn.c_str());
+ in=new IO::File(in_fn);
- ostream *out;
+ IO::Base *out;
if(out_fn=="-")
- out=&cout;
+ throw Exception("stdin/out not supported at the moment");
else
- out=new ofstream(out_fn.c_str());
+ out=new IO::File(out_fn, IO::M_WRITE);
- DataFile::Parser parser(*in, in_fn);
- DataFile::Writer writer(*out);
+ IO::Buffered in_buf(*in);
+ DataFile::Parser parser(in_buf, in_fn);
+ IO::Buffered out_buf(*out);
+ DataFile::Writer writer(out_buf);
if(binary)
writer.set_binary(true);
writer.write(st);
}
- if(out!=&cout)
+ //if(out!=&cout)
delete out;
return 0;