By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,955 Members | 1,275 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,955 IT Pros & Developers. It's quick & easy.

Best way to handle 'ostrstream'

P: n/a
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
Share this Question
Share on Google+
6 Replies


P: n/a
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

P: n/a
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

P: n/a

"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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.