Can anyone please tell me why including a new-style header might give completely different results as compared to including the old-style header in the following fairly trivial case ? Using VC++ 6, I write :
Code: CPP
#include <fstream.h>

class CMyLog : public ofstream
public :

    CMyLog& operator<<(const char * ptr)
        return *this;


int main()
    CMyLog mylog;
    mylog << "hello world";
    return 0;
The mylog file contains the string "hello world". Now just change the first line to use new-style headers, i.e. put in the following

#include <fstream>
using namespace std;

Now the mylog file contains the numeric value of a pointer !

Can anyone please tell me what is going on ? I need urgent help.

Thank you
Manish Jain

Last edited by shabbir; 19Mar2006 at 08:36.. Reason: CPP Syntax highlighting.