Fortran SFF API to data I/O streams in C++
fapid_sff_new.cc
Go to the documentation of this file.
1 
35 #define TF_FAPID_SFF_NEW_CC_VERSION \
36  "TF_FAPID_SFF_NEW_CC V1.1"
37 
38 #include <string>
39 #include <cstdio>
40 #include <fapidxx/fapidsff.h>
41 #include <fapidxx/helper.h>
42 #include <fapidxx/error.h>
43 #include <sys/types.h>
44 #include <sys/stat.h>
45 #include <unistd.h>
46 
47 using namespace fapidxx;
48 
74 int sff_new__(integer *lu, char *filename, integer *ierr, ftnlen filename_len)
75 {
76  std::string name=stringfromfstring(filename, filename_len);
77  struct stat buf;
78  int status=lstat(name.c_str(), &buf);
79  if (status==0)
80  {
81  int status=remove(name.c_str());
82  if (status==0) { *ierr=0; } else { *ierr=1; }
83  }
84  else
85  {
86  *ierr=0;
87  }
88  int retval=0;
89  return(retval);
90 } // int sff_new__
91 
92 /* ----- END OF fapid_sff_new.cc ----- */
This is the interface usually expected by Fortran programs linking to libsff.a (prototypes) ...
Definition: error.cc:44
long int integer
Fortran integer type.
Definition: fapidsff.h:66
exceptions and error handling macros (prototypes)
int sff_new__(integer *lu, char *filename, integer *ierr, ftnlen filename_len)
Delete existing file.
long int ftnlen
Fortran string size type.
Definition: fapidsff.h:70
std::string stringfromfstring(char *fstring, ftnlen slen)
create a C++ string from a Fortran string
Definition: helper.cc:51
some helper functions (prototypes)