stream I/O coversion

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there

We are converting our apps from C++ 6.0 to C++.Net 7.1. The compile fails when is sees the statement: #include <fstream.h>. In fact fstream.h is not in the 7.1 directory structure. The documentation says to use <useoldio.h> but it is not in the 7.1 directory structure either

Does 7.1 support stream I/O are not? If it does, which header file should be included? If it doesn't, is there any option other than rewriting the code to use standard file I/O

Thank

P.S. The documentation also says to use the following statement along with the fstream include: #include <iostream.h> ???
 
tomaste said:
Hi there,

We are converting our apps from C++ 6.0 to C++.Net 7.1. The compile fails
when is sees the statement: #include <fstream.h>. In fact fstream.h is not
in the 7.1 directory structure. The documentation says to use said:
Does 7.1 support stream I/O are not? If it does, which header file should
be included? If it doesn't, is there any option other than rewriting the
code to use standard file I/O?

You need to updatge your code to use ISO standard IOStreams instead of the
(now unsupported) pre-standard streams.

Typically this means removing the ".h" from the header file names (e.g.
<fstream.h> becomes <fstream>) and adding

using namespace std;

after all of your standard library #includes. There are differences in some
of the functions, but in most cases the standard streams will "just work"
where the pre-standard streams were used. The most notable exception is in
the file-opening functions, where the pre-standard streams supported more
options than standard iostreams.

Post again with a more-specific question if you run into problems getting
your code to compile using standard IOStreams, or refer to the MSDN online
content, or a good book on C++ programming ("The C++ Standard Library" by
Josuttis and "C++ IOStreams and Locales" by Langer & Kreft are good choices
for detailed information about iostreams).

HTH

-cd
 
Back
Top