Link to home
Start Free TrialLog in
Avatar of Prog_
Prog_

asked on

#include ?

Why when I use #include <iostream.h> everything is fine... it prints "Hello World"
But if I use #include <iostream> it prints numbers probably an Address ?

#include <afxwin.h>
#include <iostream> // problem


int main()
{
      CString s1("Hello World");

      std::cout << s1;

      return 0;
}
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wayside
wayside

<iostream.h> is older and has Microsoft-specific stuff in it, so it knows what to do with a CString.

<iostream> is pure STL, and doesn't know anything about MFC classes like CString. And CString doesn't have an operator<< for cout. But you should be able to cast it to do what you want:

CString s1("Hello World");
std::cout << (LPCTSTR) s1;