Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / February 2005

Tip: Looking for answers? Try searching our database.

visual studio.net 2003 professional : problem with header

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sg10241024 - 12 Feb 2005 15:49 GMT
Hello,

I included the header "iostream"

Why is there only the possiblity of including
#include<iostream>? From Visual C++ 6 I know the iostream.h.

The name doesnt't really interest me. But it should work. The library
consists of the commands like "cout", "cin", ... But if I want to use
these commands I get an compiler error that they are unknown.

What's the problem? Do I miss something?

Thanks
Sarah
Antti Keskinen - 12 Feb 2005 16:20 GMT
There's a subtle difference.

"iostream.h" is the header file for the old Standard C++ Library. This file
is deprecated in Visual C++ .NET 2003. Instead, you must use "iostream"
header and specify the namespace "std" to access the good-old "cout", "cin"
etc functions. If you wish to know more of this behaviour, search MSDN with
string "iostream differences from Standard C++ Library"

There are two choices you can use. Which one you choose is a matter of
preference and taste. Naturally, it may be a matter of namespace clashing if
you have similarly named functions, objects or structures as the Standard
C++ Library.

Solution #1: The 'using namespace' keyword (generally safe)

#include <iostream>
using namespace std;

cout << "This will print a line of text" << endl;

----

Solution #2: Full namespace resolution (always safe, but bulkier)

#include <iostream>

std::cout << "This will print a line of text, too" << std::endl;

----

Hope this helps

-Antti Keskinen

> Hello,
>
[quoted text clipped - 16 lines]
>    ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
> ----------------------------------------------------------
Ioannis Vranos - 12 Feb 2005 17:24 GMT
> Hello,
>
> I included the header "iostream"
>
> Why is there only the possiblity of including
> #include<iostream>? From Visual C++ 6 I know the iostream.h.

The official ISO C++ standard (ISO/IEC 14882:1998, and 2003) defines
<iostream>.

VC++ 6 was a pre-standard compiler. A nice book to get you up and
running with ISO C++, is "Accelerated C++" by Andrew Koenig, Barbara Moo:

http://www.acceleratedcpp.com

If you want to learn the entire language (which will take *years*), is
"The C++ Programming Language" 3rd Edition or Special Edition by Bjarne
Stroustrup, the creator of C++:

http://www.research.att.com/~bs/3rd.html

> The name doesnt't really interest me. But it should work. The library
> consists of the commands like "cout", "cin", ... But if I want to use
[quoted text clipped - 4 lines]
> Thanks
> Sarah

using namespace std;

Signature

Ioannis Vranos


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.