file io binary mode

Hi! I have, until recently, consequently written "using namespace std;" at the beginning of all my c++ programs. However, upon realizing the possible threats of doing this I have decided to stop doing it entirely. This has caused me some problems though, mainly dealing with file io (which I am also currently learning). My problem is how do I open a file in binary mode? Previously I have done this:

ifstream is("somefilename", ios::in | ios::binary);

And it worked fine. However, now that I prefix ifstream with std::, my compiler complains that ios is not declared. How can I get around this?

Peace,
Fafner
ios:: also needs an std:: in front of it I believe.
Awesome, thanks:D
There is nothing wrong with using namespace std; in .cpp files.
(Just be aware of possible namespace collisions with other libraries.)

It only becomes a problem when you using namespace anything; in header files, because anyone who #includes your header thereafter has their namespaces boogered.

Hope this helps.
Just a shot from the hip, but would there be a way to #ifdef the inclusion of libraries? I'm thinking some kind of test for a function or class... I'll be researching this myself by the way but I wanted to throw that in here.
Topic archived. No new replies allowed.