By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,979 Members | 943 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,979 IT Pros & Developers. It's quick & easy.

whats for the console output?

P: n/a
If I cant or should not use cout, whats the alternate for outputting to the
console in c++. Printf() ?
Nov 16 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
All Rise wrote:
If I cant or should not use cout, whats the alternate for outputting
to the console in c++. Printf() ?


std::cout is "the C++" way to write to the console. If you can't use the
C++ way, there's "the C way", via printf (or fprintf, etc), or the "windows
way", via WriteFile and the Console API functions.

-cd
Nov 16 '05 #2

P: n/a
yeah I know these ways thanx, but when I use cout, I get
following warning:

d:\Program Files\Microsoft Visual Studio .NET\Vc7
\include\useoldio.h(29): warning
C4995: '_OLD_IOSTREAMS_ARE_DEPRECATED': name was marked as
#pragma deprecated

so thats why I'm asking that if the compiler recommends
that I do not use cout, then what should I use?
-----Original Message-----
All Rise wrote:
If I cant or should not use cout, whats the alternate for outputting to the console in c++. Printf() ?
std::cout is "the C++" way to write to the console. If

you can't use theC++ way, there's "the C way", via printf (or fprintf, etc), or the "windowsway", via WriteFile and the Console API functions.

-cd
.

Nov 16 '05 #3

P: n/a
Ah. Then you should use new IOStreams.

#include <iostream> instead of <iostream.h>. you'll then need a 'using
namespace std;', or you'll need to refer to std::cout instead of cout.

-cd

All Rise wrote:
yeah I know these ways thanx, but when I use cout, I get
following warning:

d:\Program Files\Microsoft Visual Studio .NET\Vc7
\include\useoldio.h(29): warning
C4995: '_OLD_IOSTREAMS_ARE_DEPRECATED': name was marked as
#pragma deprecated

so thats why I'm asking that if the compiler recommends
that I do not use cout, then what should I use?
-----Original Message-----
All Rise wrote:
If I cant or should not use cout, whats the alternate for outputting
to the console in c++. Printf() ?


std::cout is "the C++" way to write to the console. If you can't
use the C++ way, there's "the C way", via printf (or fprintf, etc),
or the "windows way", via WriteFile and the Console API functions.

-cd
.

Nov 16 '05 #4

P: n/a
Cool, thanx :)
-----Original Message-----
Ah. Then you should use new IOStreams.

#include <iostream> instead of <iostream.h>. you'll then need a 'usingnamespace std;', or you'll need to refer to std::cout instead of cout.
-cd

All Rise wrote:
yeah I know these ways thanx, but when I use cout, I get
following warning:

d:\Program Files\Microsoft Visual Studio .NET\Vc7
\include\useoldio.h(29): warning
C4995: '_OLD_IOSTREAMS_ARE_DEPRECATED': name was marked as #pragma deprecated

so thats why I'm asking that if the compiler recommends
that I do not use cout, then what should I use?
-----Original Message-----
All Rise wrote:
If I cant or should not use cout, whats the alternate for outputting to the console in c++. Printf() ?

std::cout is "the C++" way to write to the console. If you can't use the C++ way, there's "the C way", via printf (or fprintf, etc), or the "windows way", via WriteFile and the Console API functions.
-cd
.

.

Nov 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.