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

◆ write_data()

void write_data ( const std::string &  name,
const bool &  verbose = false 
)

write test data

Examples:
tests/fortraniotest.cc.

Definition at line 139 of file fortraniotest.cc.

References tfxx::fortranio::FortranBinOutput::end_block(), tfxx::ioswap::file_magic_write(), and mymagic.

Referenced by main().

140 {
141  if (verbose) cout << "write data to \'" << name << "\'" << endl;
142  std::ofstream os(name.c_str());
144 
146  const int nval=10;
147  fo << nval;
148  cout << "nval: " << nval << endl;
149  for (int i=0; i<nval; i++)
150  {
151  int val1=(i+1)*4;
152  int val2=100*val1;
153  fo << val1 << val2;
154  cout << " val1/2: " << val1 << ", " << val2 << endl;
155  }
156  fo.end_block();
157  for (int i=0; i<nval; i++)
158  {
159  double val=(i+1)*15.;
160  cout << " val: " << val << endl;
161  fo << val;
162  }
163  fo.end_block();
164  long long int llint=1551;
165  long int lint=2662;
166  std::complex<double> dcplx(4.5,5.4);
167  std::complex<float> scplx(14.5,15.4);
168  fo << llint << lint << dcplx << scplx;
169  cout << "extra: " << llint << ", " << lint << ", "
170  << dcplx << ", " << scplx << endl;;
171 }
write FORTRAN binary data ,This class writes FORTRAN binary data. FORTRAN binary data is always writt...
Definition: fortranio.h:200
const char mymagic[]
void file_magic_write(std::ostream &os, const char *const cmagic, const bool &fortranmode=false)
Write magic number to file. ,.
Definition: ioswap.cc:135
Here is the call graph for this function:
Here is the caller graph for this function: