A question using ifstream to open a file

In the following codes why I have to put "ifstream::" before "binary". Since the "open" is already a method of ifstream and I am also using std namespace why do I need to put it this way "ifstream::binary" and "binary" alone does not work.

ifstream myfile;
myfile.open("file.txt",ifstream::binary);
You should probably just use std::ios::binary. You have to qualify it because it cannot be found otherwise. ADL (argument-dependent lookup) only applies to functions.
Topic archived. No new replies allowed.