473,394 Members | 1,794 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Best way to handle 'ostrstream'

I inherited a task which uses a lot of 'ostrstream' in the code. The port
is from an SGI box to Sun which is using GNU C++ (g++ version 3.4.2). When
trying to compile I get several errors all related to 'ostrstream' and the
fact that it is being deprecated from the language, etc.

What is the best way to handle fixing this replicating error?

TIA,
Eric
Nov 22 '05 #1
6 4960
Eric Chomko wrote:
I inherited a task which uses a lot of 'ostrstream' in the code. The port
is from an SGI box to Sun which is using GNU C++ (g++ version 3.4.2). When
trying to compile I get several errors all related to 'ostrstream' and the
fact that it is being deprecated from the language, etc.

What is the best way to handle fixing this replicating error?


"Replicating error"? Not sure what that is.

The immediate fix could be to turn off that warning (it's not really an
error, right?) with a command line switch. If that doesn't work, you
could use a modified (or third-party) strstream library that doesn't
issue those warnings/errors but has the same syntax (save, perhaps, the
std namespace), or you could convert it to using std::ostringstream.

Cheers! --M

Nov 22 '05 #2
mlimber (ml*****@gmail.com) wrote:
: Eric Chomko wrote:
: > I inherited a task which uses a lot of 'ostrstream' in the code. The port
: > is from an SGI box to Sun which is using GNU C++ (g++ version 3.4.2). When
: > trying to compile I get several errors all related to 'ostrstream' and the
: > fact that it is being deprecated from the language, etc.
: >
: > What is the best way to handle fixing this replicating error?

: "Replicating error"? Not sure what that is.

Sorry, not good usage. I should have said "reoccurring", as this error is
in many places in the code.

: The immediate fix could be to turn off that warning (it's not really an
: error, right?) with a command line switch. If that doesn't work, you
: could use a modified (or third-party) strstream library that doesn't
: issue those warnings/errors but has the same syntax (save, perhaps, the
: std namespace), or you could convert it to using std::ostringstream.

It is an error not a warning. Where would I put the "std::ostringstream"?
In the modified strstream include?

Eric

: Cheers! --M

Nov 22 '05 #3

"Eric Chomko" <ec*********@polaris.umuc.edu> wrote in message
news:dl**********@news.ums.edu...
mlimber (ml*****@gmail.com) wrote:
: Eric Chomko wrote:
: > I inherited a task which uses a lot of 'ostrstream' in the code. The
port
: > is from an SGI box to Sun which is using GNU C++ (g++ version 3.4.2).
When
: > trying to compile I get several errors all related to 'ostrstream' and
the
: > fact that it is being deprecated from the language, etc.
: >
: > What is the best way to handle fixing this replicating error?

: "Replicating error"? Not sure what that is.

Sorry, not good usage. I should have said "reoccurring", as this error is
in many places in the code.

: The immediate fix could be to turn off that warning (it's not really an
: error, right?) with a command line switch. If that doesn't work, you
: could use a modified (or third-party) strstream library that doesn't
: issue those warnings/errors but has the same syntax (save, perhaps, the
: std namespace), or you could convert it to using std::ostringstream.

It is an error not a warning.
We'll need to see the code causing the errors, and the text
of the error messages. I realize your code is probably too
large to post here, so try to create a small example program
which gives the same error, and post it.
Where would I put the "std::ostringstream"?
In the modified strstream include?


You'd replace all your ostrstream objects with ostringstream objects.
Some of the operations and semantics are different, so it will probably
not be a 'drop in' replacement. Compare the documentation of ostrstream
and ostringstream to see how to do what you need (btw ostringstream is
declared by <sstream> )

-Mike
Nov 22 '05 #4
Mike Wahler (mk******@mkwahler.net) wrote:

: "Eric Chomko" <ec*********@polaris.umuc.edu> wrote in message
: news:dl**********@news.ums.edu...
: > mlimber (ml*****@gmail.com) wrote:
: > : Eric Chomko wrote:
: > : > I inherited a task which uses a lot of 'ostrstream' in the code. The
: > port
: > : > is from an SGI box to Sun which is using GNU C++ (g++ version 3.4.2).
: > When
: > : > trying to compile I get several errors all related to 'ostrstream' and
: > the
: > : > fact that it is being deprecated from the language, etc.
: > : >
: > : > What is the best way to handle fixing this replicating error?
: >
: > : "Replicating error"? Not sure what that is.
: >
: > Sorry, not good usage. I should have said "reoccurring", as this error is
: > in many places in the code.
: >
: > : The immediate fix could be to turn off that warning (it's not really an
: > : error, right?) with a command line switch. If that doesn't work, you
: > : could use a modified (or third-party) strstream library that doesn't
: > : issue those warnings/errors but has the same syntax (save, perhaps, the
: > : std namespace), or you could convert it to using std::ostringstream.
: >
: > It is an error not a warning.

: We'll need to see the code causing the errors, and the text
: of the error messages. I realize your code is probably too
: large to post here, so try to create a small example program
: which gives the same error, and post it.

Will do...

: > Where would I put the "std::ostringstream"?
: > In the modified strstream include?

: You'd replace all your ostrstream objects with ostringstream objects.
: Some of the operations and semantics are different, so it will probably
: not be a 'drop in' replacement. Compare the documentation of ostrstream
: and ostringstream to see how to do what you need (btw ostringstream is
: declared by <sstream> )

Thanks,
Eric

: -Mike
Nov 23 '05 #5
Eric Chomko (ec*********@polaris.umuc.edu) wrote:
: Mike Wahler (mk******@mkwahler.net) wrote:

: : "Eric Chomko" <ec*********@polaris.umuc.edu> wrote in message
: : news:dl**********@news.ums.edu...
: : > mlimber (ml*****@gmail.com) wrote:
: : > : Eric Chomko wrote:
: : > : > I inherited a task which uses a lot of 'ostrstream' in the code. The
: : > port
: : > : > is from an SGI box to Sun which is using GNU C++ (g++ version 3.4.2).
: : > When
: : > : > trying to compile I get several errors all related to 'ostrstream' and
: : > the
: : > : > fact that it is being deprecated from the language, etc.
: : > : >
: : > : > What is the best way to handle fixing this replicating error?
: : >
: : > : "Replicating error"? Not sure what that is.
: : >
: : > Sorry, not good usage. I should have said "reoccurring", as this error is
: : > in many places in the code.
: : >
: : > : The immediate fix could be to turn off that warning (it's not really an
: : > : error, right?) with a command line switch. If that doesn't work, you
: : > : could use a modified (or third-party) strstream library that doesn't
: : > : issue those warnings/errors but has the same syntax (save, perhaps, the
: : > : std namespace), or you could convert it to using std::ostringstream.
: : >
: : > It is an error not a warning.

: : We'll need to see the code causing the errors, and the text
: : of the error messages. I realize your code is probably too
: : large to post here, so try to create a small example program
: : which gives the same error, and post it.

: Will do...

Here is the error text:

/tcore/TigErrList.cpp:136: error: `ostrstream' undeclared (first use this
function)
/tcore/TigErrList.cpp:136: error: (Each undeclared identifier is reported
only once for each function it appears in.)
/tcore/TigErrList.cpp:136: error: expected `;' before "buff"
/tcore/TigErrList.cpp:139: error: `buff' undeclared (first use this
function)

Here is the code segment:
ostrstream buff;

I'm pretty sure that the class 'oststream' is not defined.

: : > Where would I put the "std::ostringstream"?
: : > In the modified strstream include?

: : You'd replace all your ostrstream objects with ostringstream objects.
: : Some of the operations and semantics are different, so it will probably
: : not be a 'drop in' replacement. Compare the documentation of ostrstream
: : and ostringstream to see how to do what you need (btw ostringstream is
: : declared by <sstream> )

Yes, the include module strstream.h is now obsolete and it had the
definition of 'ostrstream' in it.

Eric

: Thanks,
: Eric

: : -Mike
Nov 29 '05 #6
Eric Chomko wrote:
: Mike Wahler (mk******@mkwahler.net) wrote: [snip] : : We'll need to see the code causing the errors, and the text
: : of the error messages. I realize your code is probably too
: : large to post here, so try to create a small example program
: : which gives the same error, and post it.

: Will do...

Here is the error text:

/tcore/TigErrList.cpp:136: error: `ostrstream' undeclared (first use this
function)
/tcore/TigErrList.cpp:136: error: (Each undeclared identifier is reported
only once for each function it appears in.)
/tcore/TigErrList.cpp:136: error: expected `;' before "buff"
/tcore/TigErrList.cpp:139: error: `buff' undeclared (first use this
function)

Here is the code segment:
ostrstream buff;

I'm pretty sure that the class 'oststream' is not defined.

[snip]

What is in the file strstream.h, then? Could ostrstream be in the std
namespace? If it's simply not defined, find an implementation of it
(see stlport, for instance) and use that.

Cheers! --M

Nov 29 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Charles Prince | last post by:
How do I reuse a ostrstream? So far I have replaced all code that does this "delete <ostrstream>.str()" with "<ostrstream>.freeze(0)"
1
by: becte | last post by:
I encountered the following code similar to this // some header files static char* func(int i) { ostrstream out; if (i==1) out << "ABCDE"; else if (i==2) out << "123"; else cout << "";
2
by: b83503104 | last post by:
Hi, An old code is using stuff like #include <strstream.h> ostrstream *m_actionStream; and the compiler complained syntax error before `*' token I followed some previous posts and tried...
3
by: Mathieu Malaterre | last post by:
Hello, I am trying to write this simple code: std::ostringstream s; s << 1024; std::cout << s.str() << std::endl; s.str(""); // <- problem s << 512; std::cout << s.str() << std::endl;
14
by: Howard | last post by:
Hi, I recently had a problem where I decided to store objects in a vector. (Previously, I had always stored pointers in vectors). Well, naturally, when storing an object in a vector, using...
2
by: Pep | last post by:
I have inherited a program that does this ostrstream os; os << "some text"; os.str() = '\0'; In fact is there any point doing it at all? TIA, Pep.
1
by: tcl | last post by:
Questions on ostrstream. #1) do I have a memory leak as the control exits the scope { ostrstream os; os << "hello world" << endl << ends; }
1
by: GeeBee | last post by:
1) I’m using Borland C++ Builder 1.0 (a very old (but still good) version). 2) I have an application EXE calling a DLL. 3) A function in the DLL receives a parameter defined as "ostream &" , and...
2
by: sabbadin12 | last post by:
Hi, I'm going to work on an application that uses a postgreSQL database so that it can uses SQLServer 2005. I think I solved most problems on the programming side, but I still have some doubts...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.