how to empty a stringstream?

M

minjie

Hi,
I'm writing an app that fetches a row of data from the database, and
extract the value from each column (of that row of data), and insert
each value into a linked list for later display on the GUI. Since the
values are of different data types, I'm using stringstream (say, ss)
to hold the data and converts each one into string when inserting into
the linked list. The problem is, I cannot find a method that can empty
ss before inserting another value, so I ended up with all the values
connected together in ss. For example, if column 0 has value a, column
1 has value b, column 2 has value c, ..., the linked list would end up
containing the values as follows:

node_1's value: a
node_2's value: ab
node_3's value: abc
.......
instead of
node_1's value: a
node_2's value: b
node_3's value: c
.......

Any suggestions?
Thanks in advance for any help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top