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

◆ sff_wopenfs__()

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

Open file for writing and pass FREE block and SRCE line.

Description from stuff.f:

c----------------------------------------------------------------------
subroutine sff_WOpenFS(lu, filename,
& lines, nline,
& type, cs, c1, c2, c3, date, time, ierr)
c
c Open file for writing. Write STAT line, FREE block and SRCE line.
c
c input:
c lu logical file unit
c filename name of file
c nline number of lines in FREE block
c lines lines in FREE block
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
integer lu, ierr, nline
character filename*(*), type*(*), cs*1
real c1, c2, c3
character time*(*), date*(*)
character lines(nline)*80
c----------------------------------------------------------------------

Definition at line 79 of file fapid_sff_wopenfs.cc.

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

84 {
85  int retval=0;
86  *ierr=0;
87  try {
88  datrw::oanystream &os=
89  ostreammanager.open(static_cast<int>(*lu),
90  stringfromfstring(filename, filename_len));
91  if (os.handlessrce())
92  {
93  sff::SRCE srce;
94  srce.cs=sff::coosysID(*cs);
95  srce.cx=static_cast<double>(*c1);
96  srce.cy=static_cast<double>(*c2);
97  srce.cz=static_cast<double>(*c3);
98  srce.type=stringfromfstring(type__, type_len);
99  srce.date=SRCEdate(date, time, date_len, time_len);
100  os << srce;
101  }
102  if (os.handlesfilefree())
103  {
104  sff::FREE filefree=freeblock(nline, lines, lines_len);
105  os << filefree;
106  }
107  }
108  catch (...) {
109  *ierr=1;
110  }
111  return(retval);
112 } // int sff_wopenfs__
sff::FREE freeblock(integer *nline, char *lines, ftnlen lines_len)
create C++ FREE block from Fortran FREE lines
Definition: helper.cc:150
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: