Fortran SFF API to data I/O streams in C++

◆ sff_ropen__()

int sff_ropen__ ( integer lu,
char *  filename,
real version,
char *  timestamp,
char *  code,
integer ierr,
ftnlen  filename_len,
ftnlen  timestamp_len,
ftnlen  code_len 
)

Open SFF file.

Description from stuff.f:

c----------------------------------------------------------------------
subroutine sff_ROpen(lu, filename,
& version, timestamp, code, ierr)
c
c Open file for reading. Read STAT line.
c
c input:
c lu logical file unit
c filename name of file
c ouput:
c version version of writing library
c timestamp time and date file was written
c code indicates optional blocks
c ierr error status (ok: ierr=0)
c
integer lu, ierr
real version
character timestamp*(*), code *(*)
character filename*(*)
c----------------------------------------------------------------------

Definition at line 73 of file fapid_sff_ropen.cc.

References fapidxx::fillfstring(), fapidxx::istreammanager, fapidxx::IFileUnits::open(), and fapidxx::stringfromfstring().

76 {
77  int retval=0;
78  *ierr=0;
79  try {
80  datrw::ianystream &is=
81  istreammanager.open(static_cast<int>(*lu),
82  stringfromfstring(filename, filename_len));
83  std::string ocode("");
84  if (is.hasfree()) { ocode.append("F"); }
85  if (is.hassrce()) { ocode.append("S"); }
86  // set output
87  fillfstring(ocode, code, code_len);
88  // timestamp and version got lost
89  sff::STAT stat;
90  fillfstring(stat.timestamp, timestamp, timestamp_len);
91  *version=static_cast<real>(sff::STAT::libversion);
92  }
93  catch(...) {
94  *ierr=1;
95  }
96  return retval;
97 } // int sff_ropen__
void fillfstring(const std::string &s, char *fstring, ftnlen slen)
fill a Fortran string with a C++ string
Definition: helper.cc:60
float real
Fortran real type (single precision)
Definition: fapidsff.h:73
datrw::ianystream & open(const int &unit, const std::string &filename)
open a new file
Definition: fileunit.cc:77
std::string stringfromfstring(char *fstring, ftnlen slen)
create a C++ string from a Fortran string
Definition: helper.cc:51
::fapidxx::IFileUnits istreammanager
the global istream manager
Definition: fileunit.cc:48
Here is the call graph for this function: