If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

IO functions

Hey guys:

I've recently started hoarding C++ tutorials to get my info from various sources. One problem though: The Dev-Cpp tutorial uses the header stdio.h and printf(scanf) functions.

Like one other tutorial I have follows this (and, honestly, I much prefer it). But the rest use another header in addition, iostream.h, which Dev-Cpp does not include (at least not under that name) and this command for IO: cout &lt;&lt; / cin &lt;&lt;

Note: Dev does include some sort of iostream, which is basically a reference to another header, but it doesn't seam to work with cout &lt;&lt;.

I'm a newb (just re-stating the obvious). Which header works with what, and which is most common (function)

Thanks

\"I ONLY DRINK THE BLOOD OF MY ENEMIES....and maybe a strawberry yoohoo....and a...Pina Co-la-da!...
If you like pina coladas....ugh!, gettin\' caught in the rain....ugh!\"
-Sarge

stdio.h, printf() and scanf() are all C functions. That doesn't mean you can't use them in C++, just that C++ provides alternatives. iostream.h, cin and cout are C++ only things. My version of Dev C++ does cin and cout fine, as should any C/C++ compiler.

I think of C++ as a superset of C. Everything that I can do in C can also be done in C++. That does not mean that everything I can do in C++ can be done in C. The tutorieals that use printf or scanf are valid for C++ even through they are C functions.

Cheers,
-D

If you spend more on coffee than on IT security, you will be hacked. What\'s more, you deserve to be hacked.
-- former White House cybersecurity adviser Richard Clarke

With some compilers, however, it matters what the extension on the file is. Sometimes they won't be keen on even trying to interpret a .c file as anything other than c. So you might have an issue there, sometimes, if you're not careful.

Other than that it has already been stated where the functions are. For gcc a lot of the basic [like scanf()/printf()] functions don't even need a header to be declared [although doing so ensures better portability]