DATRW++ library: seismic data I/O with multiple formats

◆ file_magic_write()

void datrw::util::file_magic_write ( std::ostream &  os,
const char *const  cmagic,
const bool &  fortranmode = false 
)

write magic number to file

Write magic number to file. ,.

Parameters
osoutput stream to write to
cmagic4-byte character sequence representing magic number (most restrictive: pass a const pointer to a const char) is pointer to character array of size sizeof(int)
fortranmodeuse Fortran binary I/O if true

Definition at line 128 of file bytesex.cc.

References datrw::util::IOUnion< T >::bytes, magic(), and datrw::util::IOUnion< T >::value.

Referenced by datrw::binary::obinstream::obinstream().

130  {
131  IOUnion<int> ifour, imagic;
132  ifour.value=sizeof(int);
133  imagic.value=magic(cmagic);
134  if (fortranmode) os.write(ifour.bytes, sizeof(int));
135  os.write(imagic.bytes, sizeof(int));
136  if (fortranmode) os.write(ifour.bytes, sizeof(int));
137  } // file_magic_write()
int magic(const char *const cmagic)
function to create the magic number
Definition: bytesex.cc:52
Here is the call graph for this function:
Here is the caller graph for this function: