473,794 Members | 2,748 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

strstream and ostrstream with new g++

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 things like
#include <strstream.h>
or
#include <sstream>
and
std::ostringste am *m_actionStream ;
but all in vain.

Is there any simple way (adding a couple of lines) to make the old code
work, instead of rewriting everything?
Thanks

Jul 22 '05 #1
2 3870
b8*******@yahoo .com wrote:
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 things like
#include <strstream.h>
or
#include <sstream>
Try #include <strstream>
and
std::ostringste am *m_actionStream ;
but all in vain.

Is there any simple way (adding a couple of lines) to make the old
code work, instead of rewriting everything?
Thanks


Jonathan
Jul 22 '05 #2
b8*******@yahoo .com wrote:
An old code is using stuff like
#include <strstream.h>
This header is no called <strstream> and it is deprecated. However,
deprecation just means that you should probably not use it in new
code and you might want to consider replacing it in old code if you
are working on it anyway.
ostrstream *m_actionStream ;
The 'ostrstream' class is know declared in namespace 'std', i.e.
want to use one of the following:

- 'std::ostrstrea m* m_actionSteram; '
- 'using std::ostrstream ;' and leave the definition as is.
- 'using namespace std;' and leave the definition as is.

(listed in order of my preference).

The advantage of the latter two approach over the first one is that
you can put the stuff at just one location, e.g. immediately after
the include directive. However, you should not use the 'using'
approaches at the global scope in headers (the name of your
variable seems to indicate that it is actually a member of a class).
Is there any simple way (adding a couple of lines) to make the old code work, instead of rewriting everything?


Essentially, this should do the trick:

| #include <strstream>
| using std::ostrstream ;

If this does not work, please post a complete code excerpt which
displays the problem (and has no other problems...).
--
<mailto:di***** ******@yahoo.co m> <http://www.dietmar-kuehl.de/>
<http://www.contendix.c om> - Software Development & Consulting

Jul 22 '05 #3

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

Similar topics

6
2862
by: vishnu mahendra | last post by:
hello to all, #include<iostream.h> #include<conio.h> #include <strstream.h> void main() { clrscr(); strstream str; char *a = new char; int i;
9
7465
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
1259
by: News For Mohan | last post by:
Hi, I am using ostrstream object.I am using the str() function to get the char buffer. The function is returning the pointer of char buffer , but it is adding some garbage at the end. This behaviour is not predictable . Sometimes it is returning the char buffer correctly , sometimes it is returning the char buffer and some garbage attached to it at the end.I am initialising the ostrstream object by fill('\0') function. Can U please...
2
2318
by: derek | last post by:
Hi, I'm trying to compile someone's code which uses ostrstream. I know it's declared in file strstream, but I can't find this file in the /usr/include/c++/3.3.3 directory. There is a file called sstream, but it doesn't work when I include sstream. Do you guys know what's wrong? Thanks in advance.
7
3820
by: forrest | last post by:
I wrote a function like this: #define LEN 8 void foo(ostream& decry_stream ) { ifstream ifile( filepath.c_str(), ios_base::binary ); while ( !ifile.eof() ) { ifile.read((char *)(&aucCipherText), LEN); read_count = ifile.gcount();
1
2803
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; }
2
2702
by: Praveen Chandra | last post by:
Hi, I am trying to build a static library, while building the library i am getting the following error: fatal error C1189: #error : "No sstream/strstream implementation" Following is the code that is giving error: #ifdef HAVE_CONFIG_H
1
2380
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 writes error messages to this stream using the “<<” operator. 4) The EXE file creates an ostrstream variable and passes this to the DLL function. 5) After the DLL function has finished, the EXE writes some text to an output file, followed by the...
5
3742
by: nithya4u | last post by:
I am working on a c++ module, where large amount of data needs to be written to a stream and str() method is been used to assign the value of this to the char*. This produces the intended result. But when i run purify on it i get the following results. MLK: Memory leak of 8656 bytes from 9 blocks allocated in strstreambuf::doallocate(void) Distribution of leaked blocks 987 bytes from 1 block of 987 bytes (0x03977ea8) 980 bytes from 1...
0
9518
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10161
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9035
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6777
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4112
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2919
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.