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:
There is nothing wrong with usingnamespace std; in .cpp files.
(Just be aware of possible namespace collisions with other libraries.)
It only becomes a problem when you usingnamespaceanything; in header files, because anyone who #includes your header thereafter has their namespaces boogered.
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.