Professional Documents
Culture Documents
* File: 20160916_CPP_L05.cpp.
* Title: 2016-09-16 C++ Lesson 05
* Author: Renato Montes
* Description: Notes for Albert Wei's C++ class
*/
/* ostringstream */
#include <sstream>
//allows us to print a string
//easy example
/* File I/O */
#include <fstream>
//ifstream/ofstream/fstream
//ctor can take a 2nd argument that specifies the open mode
//type: ios_base::openmode
//possible values: ios_base::in, out, app, trunc, ate, binary
// app append
// trunc truncate
/** TODO find what ate is */ //Answer: ate = at end
//We can combine them using bitwise-or
ifstream in("data", ios_base::in|ios_base::binary);
//when there's no 2nd argument it's text mode basically
//if you specify the 2nd argument you need to specify in explicitly
if(!is)
break;
}
}