TF++, Miscellaneous classes and modules in C++:

◆ file_magic_write()

void tfxx::ioswap::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
Examples:
tests/fortraniotest.cc.

Definition at line 135 of file ioswap.cc.

References tfxx::ioswap::IOUnion< T >::bytes, magic(), and tfxx::ioswap::IOUnion< T >::value.

Referenced by write_data(), and tfxx::hacks::write_grepg_c().

137 {
138  IOUnion<int> ifour, imagic;
139  ifour.value=sizeof(int);
140  imagic.value=magic(cmagic);
141  if (fortranmode) os.write(ifour.bytes, sizeof(int));
142  os.write(imagic.bytes, sizeof(int));
143  if (fortranmode) os.write(ifour.bytes, sizeof(int));
144 } // file_magic_write()
int magic(const char *const cmagic)
Create a magic number from a character string. ,If represents the input character sequence cmagic an...
Definition: ioswap.cc:59
Here is the call graph for this function:
Here is the caller graph for this function: