typedef struct {
char c[20];
int i;
} header;
void foo(std::string s) {
std::ifstream ifs(s.c_str(), std::ios_base::binary | std::ios_base::in);
if (ifs) {
there is a
read
forifstream
Yes, and that's what you use to read unformatted data from the stream; hence the name.
if I'm supposed to use that method, what is the point of
filebuf
?
It's used by the stream to handle low-level file access and buffering. You can access it if you need to mess around with those details, but usually there's no need to. You certainly wouldn't mess around with it if you just want to read from the stream.