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

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2008
Posts: 10
Reputation: jadedman is an unknown quantity at this point 
Solved Threads: 0
jadedman jadedman is offline Offline
Newbie Poster

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

 
0
  #1
Sep 15th, 2008
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?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,648
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1498
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

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

 
0
  #2
Sep 15th, 2008
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.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 10
Reputation: jadedman is an unknown quantity at this point 
Solved Threads: 0
jadedman jadedman is offline Offline
Newbie Poster

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

 
0
  #3
Sep 16th, 2008
thanks
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 1,089
Reputation: vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all 
Solved Threads: 164
vijayan121 vijayan121 is offline Offline
Veteran Poster

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

 
1
  #4
Sep 16th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 55
Reputation: MelechM is an unknown quantity at this point 
Solved Threads: 6
MelechM MelechM is offline Offline
Junior Poster in Training

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

 
0
  #5
Sep 16th, 2008
Yes they can.
Sir, they have us surrounded; those poor bastards
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,861
Reputation: ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all 
Solved Threads: 120
ithelp's Avatar
ithelp ithelp is offline Offline
Posting Virtuoso

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

 
0
  #6
Sep 17th, 2008
Why would you need stdio.h in C++ ?
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 10
Reputation: jadedman is an unknown quantity at this point 
Solved Threads: 0
jadedman jadedman is offline Offline
Newbie Poster

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

 
0
  #7
Sep 17th, 2008
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...
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,648
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1498
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

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

 
0
  #8
Sep 17th, 2008
Originally Posted by jadedman View Post
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)
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 2,980
Reputation: niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute 
Solved Threads: 308
Moderator
Featured Poster
niek_e's Avatar
niek_e niek_e is online now Online
Cenosillicaphobiac

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

 
0
  #9
Sep 17th, 2008
Originally Posted by jadedman View 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?
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.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 11
Reputation: Jawahar prabhu is an unknown quantity at this point 
Solved Threads: 1
Jawahar prabhu Jawahar prabhu is offline Offline
Newbie Poster

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

 
0
  #10
Sep 17th, 2008
you can use both h.files, but what kind of need arise for both ?
Be patience
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 1168 | Replies: 9
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC