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

◆ sff_new__()

int sff_new__ ( integer lu,
char *  filename,
integer ierr,
ftnlen  filename_len 
)

Delete existing file.

Description from stuff.f:

c----------------------------------------------------------------------
subroutine sff_New(lu, filename, ierr)
c
c This routine just deletes the file indicated by filename. You need this
c as all WOpen routines refuse to replace an existing file. You will have
c to remove this file first and than open a new one.
c
c input:
c lu logical file unit to use for operation
c filename name of file to be deleted
c output:
c ierr will be 0 if operation was successfull
c
integer lu, ierr
character filename*(*)
c
c----------------------------------------------------------------------

Definition at line 74 of file fapid_sff_new.cc.

References fapidxx::stringfromfstring().

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__
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: