A complete example is provided in writetest.cc
You should include
to write data and
to read data.
Consider that the properties of your output file are given as
std::string outfile;
bool overwrite;
Open the output file:
std::ofstream ofs(outfile.c_str(),
datrw::oanystream::openmode(outputformat));
A way to report the data type used to store sample values:
cout << "file data is stored in ";
switch (os.seriestype()) {
cout << "integer";
break;
cout << "single precision floating point";
break;
cout << "double precision floating point";
break;
cout << "any desired";
break;
default:
TFXX_abort("output stream uses unknown variable type!");
}
cout << " variable type" << endl;
Consider that input is copied from an
Copy file header data:
if (is.hasfree())
{
if (os.handlesfilefree())
{
sff::FREE filefree;
is >> filefree;
os << filefree;
}
else
{
cout << "file FREE block is discarded." << endl;
}
}
if (is.hassrce())
{
if (os.handlessrce())
{
sff::SRCE srceline;
is >> srceline;
os << srceline;
}
else
{
cout << "SRCE line is discarded." << endl;
}
}
Read the input series:
aff::Series<double> series;
is >> series;
Pass trace header data:
sff::WID2 wid2;
is >> wid2;
os << wid2;
if (is.hasinfo())
{
if (os.handlesinfo())
{
sff::INFO infoline;
is >> infoline;
os << infoline;
}
else
{
if (opt.verbose)
{
cout << " INFO line is discarded." << endl;
}
}
}
if (is.hasfree())
{
if (os.handlestracefree())
{
sff::FREE freeblock;
is >> freeblock;
os << freeblock;
}
else
{
if (opt.verbose)
{
cout << " trace FREE block is discarded." << endl;
}
}
}
Write actual time series:
- Date
- 17.12.2010