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

◆ match_magic()

bool tfxx::fortranio::FortranBinInput::match_magic ( const char *  cmagic)

expect magic number and adjust swapping flag

look out for expected magic number and adjust swapping flag

Definition at line 137 of file fortranio.cc.

References tfxx::ioswap::file_magic_test(), finish_block(), tfxx::ioswap::magic_nomatch, tfxx::ioswap::magic_swap, Mistream, and Mswap.

Referenced by tfxx::fortranio::operator>>().

138  {
139  // skip rest of previous block
140  this->finish_block();
142  =tfxx::ioswap::file_magic_test(Mistream, cmagic, true);
143  if (result==tfxx::ioswap::magic_nomatch) return(false);
144  if (result==tfxx::ioswap::magic_swap) { Mswap=true; }
145  else { Mswap=false; }
146  return(true);
147  }
std::istream & Mistream
The input stream to read from.
Definition: fortranio.h:169
Emagic_type file_magic_test(std::istream &is, const char *const cmagic, const bool &fortranmode=false)
Check for magic number in file.
Definition: ioswap.cc:112
The bytesex of the file must be swapped to match this machine.
Definition: bytesex.h:118
Emagic_type
Define bytesex indicator for magic number test.
Definition: bytesex.h:114
The magic number does match the file.
Definition: bytesex.h:120
void finish_block()
finish open block
Definition: fortranio.cc:93
bool Mswap
Has byte swapping to be performed.
Definition: fortranio.h:171
Here is the call graph for this function:
Here is the caller graph for this function: