![]() |
| ||
| working with stringstream I am storing some data in a sting & I'm retriving it using stringstream but the problem is that it repeates last element two times.I could not understand why is this happning?Is there anyone who can help me on solving this problem? Programme code is as follows::::::::::::: #include<iostream> |
| ||
| Re: working with stringstream Reason is that sstr is set to false AFTER trying to read after EOF. So first you read last item, it's ok, when while sees no error, continues, but you can't read more, so x is assigned to last good reading (last number) AND then sstr is set to FALSE! You need this: while (sstr>>x){//do stuff with x} |
| ||
| Re: working with stringstream [/ICODE][/QUOTE] thanks a million u sci@phy I've tried & it is working well as per my requirement |
| All times are GMT -4. The time now is 9:48 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC