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

◆ sff_wopens__()

int sff_wopens__ ( integer lu,
char *  filename,
char *  type__,
char *  cs,
real c1,
real c2,
real c3,
char *  date,
char *  time,
integer ierr,
ftnlen  filename_len,
ftnlen  type_len,
ftnlen  cs_len,
ftnlen  date_len,
ftnlen  time_len 
)

Open file for writing and pass SRCE line.

Description from stuff.f:

c----------------------------------------------------------------------
subroutine sff_WOpenS(lu, filename,
& type, cs, c1, c2, c3, date, time, ierr)
c
c Open file for writing. Write STAT line and SRCE line.
c
c input:
c lu logical file unit
c filename name of file
c type type of source (any 20 character string)
c cs coordinate system (S: spherical, C: cartesian)
c c1, c2, c3 coordiantes as defined by SFF
c time, date time and date of source signal
c output:
c ierr error status (ok: ierr=0)
c
c----------------------------------------------------------------------

Definition at line 70 of file fapid_sff_wopens.cc.

References fapidxx::OFileUnits::open(), fapidxx::ostreammanager, fapidxx::SRCEdate(), and fapidxx::stringfromfstring().

74 {
75  int retval=0;
76  *ierr=0;
77  try {
78  datrw::oanystream &os=
79  ostreammanager.open(static_cast<int>(*lu),
80  stringfromfstring(filename, filename_len));
81  if (os.handlessrce())
82  {
83  sff::SRCE srce;
84  srce.cs=sff::coosysID(*cs);
85  srce.cx=static_cast<double>(*c1);
86  srce.cy=static_cast<double>(*c2);
87  srce.cz=static_cast<double>(*c3);
88  srce.type=stringfromfstring(type__, type_len);
89  srce.date=SRCEdate(date, time, date_len, time_len);
90  os << srce;
91  }
92  }
93  catch (...) {
94  *ierr=1;
95  }
96  return(retval);
97 } // int sff_wopens__
datrw::oanystream & open(const int &unit, const std::string &filename)
open a new file
Definition: fileunit.cc:147
libtime::TAbsoluteTime SRCEdate(char *date, char *time, ftnlen date_len, ftnlen time_len)
create appropriate time string for SRCE line
Definition: helper.cc:127
::fapidxx::OFileUnits ostreammanager
the global ostream manager
Definition: fileunit.cc:51
std::string stringfromfstring(char *fstring, ftnlen slen)
create a C++ string from a Fortran string
Definition: helper.cc:51
Here is the call graph for this function: