473,804 Members | 3,562 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reusing instances of basic_stringstr eam

I am using basic_stringstr eam for creating character set neutral
strings.

If I use it like this:

basic_stringstr eam<wchar_t> str1, str2;

/*1*/ str1<<"A="<<int 1<<"; B="<<chr2<<"; C="<<str1<<std: :endl;

...

/*2*/ str1<<"D="<<dbl 1<<"E="<<flt2<< std::endl;

then after the second set of inserts, what I get is the cumulative
result of the two inserts.
Instead I want each insert to overwrite the previous insert. Any
suggestions.

Cheers,
Andy
Jul 22 '05 #1
2 2154
On 20 Nov 2003 05:00:43 -0800, ga***********@y ahoo.com (Andy) wrote:
I am using basic_stringstr eam for creating character set neutral
strings.

If I use it like this:

basic_stringstr eam<wchar_t> str1, str2;

/*1*/ str1<<"A="<<int 1<<"; B="<<chr2<<"; C="<<str1<<std: :endl;

...


str1.str(std::s tring()); //set the held string to the empty string.

Also, you might need:
str1.clear(); //clears the error state of the stream (if necessary)

Tom
Jul 22 '05 #2
Thanks. I overlooked your answer to another post with the same question.

tom_usenet <to********@hot mail.com> wrote in message news:<1l******* *************** **********@4ax. com>...
On 20 Nov 2003 05:00:43 -0800, ga***********@y ahoo.com (Andy) wrote:
I am using basic_stringstr eam for creating character set neutral
strings.

If I use it like this:

basic_stringstr eam<wchar_t> str1, str2;

/*1*/ str1<<"A="<<int 1<<"; B="<<chr2<<"; C="<<str1<<std: :endl;

...


str1.str(std::s tring()); //set the held string to the empty string.

Also, you might need:
str1.clear(); //clears the error state of the stream (if necessary)

Tom

Jul 22 '05 #3

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

Similar topics

2
9309
by: Jo Voordeckers | last post by:
Hello all, I'm pretty new to the Java newsgroups so I apologize for dropping this into several maybe offtopic groups. I'm sorry! So on to my problem... I've come to a point in our RMI application where I need to have server callbacks to the client RMI applications. I've used the technique where the client passes an UnicastRemoteObject of itself to a RMI server method that registers the clientinterface object in a Vector. Now when I do...
6
1690
by: Ivan Voras | last post by:
Can this be done: (this example doesn't work) ---- class A: def a_lengthy_method(self, params): # do some work depending only on data in self and params class B:
3
3181
by: Alan Krueger | last post by:
Greetings, I've been able to cache Transformer objects in a Tomcat-based servlet application to avoid unnecessary Transformer rebuilding, except for certain ones on certain machines. I'm running Tomcat 4.1.27 under Eclipse 2.1.0 using the Sysdeo Tomcat plugin using j2re1.4.1_02 under Windows 2000 SP4. I've digested this down to a small (albeit convoluted) sample that exhibits the behavior reliably on my development workstation.
9
2355
by: Alan | last post by:
Using VC++ (1998) compiler with PFE32 editor in Win2K Pro SP4. (DigitalMars CD on order. ) The program (below) instantiates a class and then deletes it. I would have thought that reusing the deleted pointer would have caused an exception, but it does not - or my coding or thinking is incorrect? #include <iostream> using namespace std;
4
9062
by: Old Wolf | last post by:
#include <stdio.h> #include <stdarg.h> Is this safe: void foo(const char *fmt, ...) { va_list ap; va_start(ap,fmt);
2
285
by: Mariano Drago | last post by:
Hi there. It will sound like a stupid question, but i cant figure out how to resolve this... Doing a little profiler job on the app im writing, i found a bottleneck in some parts that involve DB access to retrieve User information. Basically, i have an "User" class. The ctor of this class uses a method in the data access layer. As you may figure it out, the method execs a SP and pass the info back to the class, who load the data into...
4
3150
by: Tedb | last post by:
Is there any reason why you can't reuse a delegate object instance versus creating a new one each time? For example in the following scenario I have a DataPoints object with an array of DataPoint objects, each of these has a Changed event. My Client objects subscribe to some or all of the DataPoint Changed events. Client1 creates a new delegate instance for each DataPoint event subscribed to, while Client2 creates one delegate instance...
26
2392
by: John Salerno | last post by:
I probably should find an RE group to post to, but my news server at work doesn't seem to have one, so I apologize. But this is in Python anyway :) So my question is, how can find all occurrences of a pattern in a string, including overlapping matches? I figure it has something to do with look-ahead and look-behind, but I've only gotten this far: import re string = 'abababababababab'
1
2887
by: wolverine | last post by:
Hi, Given below is a traits with unsigned short. If i create a stringstream with this traits will there be any problem. struct XMLCh_traits { typedef unsigned short char_type; typedef unsigned int int_type;
0
9582
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
10323
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
10082
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
9157
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
7621
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
6854
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
5525
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...
0
5652
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3821
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.