prevent function returned pointer from going out of scope?
<p>I am opening a directory with opendir (which returns dir *) and want to keep and reuse the dir constantly in my object.  I had originaly opened the directory in my constructor and stored the pointer as a private variable, this obviously failed since as soon as the constructor ended the pointer was out of scope and the memory freed.</p>

<p>My question is, how do I keep the directory reference so that my class can keep using it over and over without reopening it each time?  I've tried copying it to a DIR type, but I get a complaint that DIR is not fully defined.  I doubt even if I could figure out where DIR is defined it will have a copy constructor anyways.  There must be another way to keep it in scope?</p>
