evazkj
10/31/2018 - 1:52 PM

C++ i/o stream

I/O stream related

//a line in file: A B C D
bsl::getline(istr, line);
bsl::stringstream lineStream;
lineStream << line;
lineStream >> c.tkr() >> c.shares >> c.dividend() >> c.numDivs();

Basic usage:

#include  <bsl_fstream.h>
bsl::ofstream outf(filename);
if (!outf.is_open())
  • File reading mode:
    • app
    • ate: at end
    • binary
    • in
    • out
    • trunc: truncate: any current content is discarded
  • bsl::ofstream outf(filename, bsl::ios::app)
  • bsl::getline(filestream, str)