ios::operator void *
operator void * ( ) const; | ios |
cplusplus.com |
Convert stream to pointer.
A stream derived from ios can be casted to a pointer.
This pointer is null if
any of the error flags failbit or badbit is set.
Otherwise a non-zero pointer (not intended to be referenced - just to indicate success)
is returned.
Parameters.
Return Value.
0 if failbit or badbit is set.
non-zero otherwise.
Example.
// ios, casting to pointer
#include <iostream>
#include <fstream>
using namespace std;
int main () {
ifstream is;
is.open ("test.txt");
if ( (void*)is == 0)
cerr << "Error opening 'test.txt'\n";
return 0;
}
Basic template member declaration ( basic_ios<charT,traits> ):
operator void * () const; |
See also.
fail,
operator!
ios class