pcb@gator.cacs.usl.edu (Peter C. Bahrs) (08/08/90)
I am trying to recompile some C++ code with the new 2.0 turbo
compiler. There are a bunch of errors regarding the use of
filebuf with open and ostream with << ?????
The books only say how to migrate to 2.0 unless I missed something.
I have selected the medium memory model, add the file prog1.cpp and the
library oldstrmm.lib to the project file and tried to compile...ERRRRROOOR
I turned default libs off....ERRRRROOR
The chunk of code that barfs looks like:
#include <stream.h>
filebuf f;
f.open ("thisfile", input);
istream i(&f);
This works on all other non 2.0 compilers I have (AT&T GNU Zortech).
Any ideas?
/*----------- Thanks in advance... --------------------------------------+
| Peter C. Bahrs |
| The USL-NASA Project |
| Center For Advanced Computer Studies INET: pcb@gator.cacs.usl.edu |
| 2 Rex Street |
| University of Southwestern Louisiana ...!uunet!dalsqnt!gator!pcb |
| Lafayette, LA 70504 |
+-----------------------------------------------------------------------*/wallis@labc.enet.dec.com (Barry L. Wallis) (08/11/90)
In article <12838@rouge.usl.edu>, pcb@gator.cacs.usl.edu (Peter C. Bahrs) writes... >I am trying to recompile some C++ code with the new 2.0 turbo >compiler. There are a bunch of errors regarding the use of >filebuf with open and ostream with << ????? > >The books only say how to migrate to 2.0 unless I missed something. > >I have selected the medium memory model, add the file prog1.cpp and the >library oldstrmm.lib to the project file and tried to compile...ERRRRROOOR > >I turned default libs off....ERRRRROOR >The chunk of code that barfs looks like: > >#include <stream.h> > >filebuf f; >f.open ("thisfile", input); > >istream i(&f); > > >This works on all other non 2.0 compilers I have (AT&T GNU Zortech). > >Any ideas? > Yes. You are using the older stream format. If you want to continue doing that you should read the file OLDSTR.DOC. However, should you want to upgrade to the 2.0 version read pages 183-185 (admittedly, there is not much there) in the Turbo C++ Programmer's Guide. If, OTOH, your goal is to write 2.0 style streams, the following code should accomplish what you are trying to do: #include <fstream.h> ifstream i("thisfile"); It may help you to look in the Turb C++ Getting Started manual as well (pages 184-193). --- Barry L. Wallis USENET: wallis@labc.dec.com Database Consultant Prodigy (don't laugh): DNMX41A U.S. DECtp Resource Center DECUServe: EISNER::WALLIS (not on the net yet) Los Angeles, CA "No one voted for me, I represent myself" ---