943,906 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 1696
  • C++ RSS
Sep 15th, 2008
0

can stdio.h be in one program with iostream.h?

Expand Post »
hello there!
im creating a program with both stdio.h and iostream.h in the include header.
Can the program run with them both? or others?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jadedman is offline Offline
10 posts
since Sep 2008
Sep 15th, 2008
0

Re: can stdio.h be in one program with iostream.h?

If you are uisng VC++ 2005 or 2008 then you can't use iostream.h at all. That file is obsolete and has been replace with <iostream>

And yes, you can have stdio.h and <iostream> both in the same program.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,953 posts
since Aug 2005
Sep 16th, 2008
0

Re: can stdio.h be in one program with iostream.h?

thanks
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jadedman is offline Offline
10 posts
since Sep 2008
Sep 16th, 2008
1

Re: can stdio.h be in one program with iostream.h?

for the predefined streams, it's safe to mix C stdio and C++ iostreams. you can safely use stdin and std::cin in the same program; the C++ Standard guarantees that it will work the way you would expect it to.

if you don't need to mix C stdio and C++ iostreams on the same stream, you can get better performance by turning this feature off std::ios_base::sync_with_stdio(false);

however, if you need to open a file with C++ iostreams, and at the same time access that file as a C FILE*, there's nothing in the C++ standard to support that usage by default. however, the library is extensible, and a std::streambuf derived class that supports this is just a couple of dozen lines of code.
Reputation Points: 1159
Solved Threads: 285
Posting Virtuoso
vijayan121 is offline Offline
1,606 posts
since Dec 2006
Sep 16th, 2008
0

Re: can stdio.h be in one program with iostream.h?

Yes they can.
Reputation Points: 11
Solved Threads: 6
Junior Poster in Training
MelechM is offline Offline
55 posts
since Sep 2008
Sep 17th, 2008
0

Re: can stdio.h be in one program with iostream.h?

Why would you need stdio.h in C++ ?
Reputation Points: 769
Solved Threads: 128
Banned
ithelp is offline Offline
1,910 posts
since May 2006
Sep 17th, 2008
0

Re: can stdio.h be in one program with iostream.h?

i always start with stdio.h in my programs (im a newbie),
but now im trying to explore other header files like
iostream.h and im starting there...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jadedman is offline Offline
10 posts
since Sep 2008
Sep 17th, 2008
0

Re: can stdio.h be in one program with iostream.h?

Click to Expand / Collapse  Quote originally posted by jadedman ...
i always start with stdio.h in my programs (im a newbie),
but now im trying to explore other header files like
iostream.h and im starting there...
Forget iostream.h -- use <iostream> (without the .h extension)
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,953 posts
since Aug 2005
Sep 17th, 2008
0

Re: can stdio.h be in one program with iostream.h?

Click to Expand / Collapse  Quote originally posted by jadedman ...
hello there!
im creating a program with both stdio.h and iostream.h in the include header.
Can the program run with them both? or others?
As Ancient Dragon mentioned: change <iostream.h> to <iostream>. If this doesn't work on your compiler (probably Turbo...), you need to update your compiler to a modern one. Visual Studio (c++) 2008 free for example.

Here's a nice thread with some explanation about headers and also a list of which header are c/c++ standard and what they do.
Moderator
Featured Poster
Reputation Points: 4142
Solved Threads: 394
Industrious Poster
Nick Evan is offline Offline
4,132 posts
since Oct 2006
Sep 17th, 2008
0

Re: can stdio.h be in one program with iostream.h?

you can use both h.files, but what kind of need arise for both ?
Reputation Points: 8
Solved Threads: 1
Newbie Poster
Jawahar prabhu is offline Offline
21 posts
since Sep 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: How Do I . . . Make a Class Accessible from a DLL
Next Thread in C++ Forum Timeline: determinant 'pow'





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC