I have a problem printing to a file, this is the main code:
and this is the overloaded << operator:
for( i = 0; i < polys.size( ); i++ )
fileOut << "POLYGON " << i << " :" << endl;
fileOut << "Normal : " << *polys[ i ].getNormal( ) << endl; //no operator << defined??
// cout << "Normal : " << *polys[ i ].getNormal( ) << endl; //prints to screen as expected
for( int j = 0; j < polys[ i ].getCornerCount( ); j++ )
Vector3d temp( polys[ i ].getPoint( j ) );
// fileOut << temp << endl;
fileOut << endl << endl;
The getNormal(...) function returns a pointer which can be dereferenced and printed to the screen but not to file. Why is this?? The other commented out line "fileOut << temp << endl;" should also work in the same way but doesn't. Is it the overloaded operator or something else?
ostream& operator << ( ostream& os, const Vector3d&a )
os << "( " << a.triple[ 0 ] << " , " << a.triple[ 1 ] << " , " << a.triple[ 2 ] << " )";