help with a header file and getchar

i read the entire 'the console closing down' thread http://www.cplusplus.com/forum/beginner/1988/ and i was wondering...

1) When i write C++ code can i use the <stdio.h>? If yes, are cross platform the contents of <stdio.h> when i write C++ code? I would love to use some functions from there.

2)If the answer is still yes, can i incorporate to my project some c header files(in order to use some functions from there) and write some code in c++?

3a) Now, something irrelevant to questions 1) and 2) .
When i write exclusively C code(not C++ like above) for some homemade toy can i use getchar() twice to pause the screen and remain comliant with the cross platform portability? Is it a good practice to use getchar? 3b)or it is a bad habbit for future serious projects? Why?
Any alternative (to getchar for c language )piece of code or a link to a website post? The thread 'the console closing down' covers the c++ if i recall well.
Last edited on
The proper form for using the good 'ol stdio header nowadays is...

#include <cstdio>

This is likely the most venerable member of the C Standard Library, which, to the best of my knowledge, is also a part of C++. So any and all functions declared within it should work equally well in *nix or Windows.

I use getchar() all the time in whatever C++ programs I write that are console programs. Usually testing type programs. Nothing in the C Standard Library bloats binaries like stuff from the C++ Standard Library (iostream, string, etc.). Fact is, I use cstdio for all my file i/o too. IMNSHO works as good or better than anything in iostream,, and you get no bloat.
The C standard library is more portable than C++'s, so you don't have to worry about it not being cross-platform (this doesn't mean that you should solely use stdio, though).

Freddy isn't lying. The C++ standard library can bloat your executable quite a bit (nothing on the level of C# and Java), but it provides us with pretty useful tools. String manipulation is much easier using the C++ standard library, for example.
Topic archived. No new replies allowed.