Board index » cppbuilder » Re: Getting my hands on "DataString"

Re: Getting my hands on "DataString"


2003-08-21 03:13:11 AM
cppbuilder42
"Torben Laursen" < XXXX@XXXXX.COM >wrote in message
Quote
Does any one know how to copy the data in
pss->DataString to a AnsiString so that I can
work with it?
The DataString property is already an AnsiString. Simply assign it to your
AnsiString variable like you are already doing. There is nothing wrong with
the code you have shown, although I would suggest that you rename your
variable to something other than "String" as "String" is already being used
by the VCL as a typedef for the AnsiString class. Asside from that,
whatever problem you are having, it is going to be related to storing the
TChart data into the TStringStream in the first place, not with accessing
the TStringStream afterwards.
Gambit
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (www.grisoft.com).
Version: 6.0.510 / Virus Database: 307 - Release Date: 8/14/03
 
 

Re:Re: Getting my hands on "DataString"

"Torben Laursen" < XXXX@XXXXX.COM >wrote in message
Quote
If I change the code like below, it shows that SaveChartToStream
works fine, but I can still not get my hand on the whole string in
DataString.
I do not know what else to tell you. Again, there is nothing wrong with the
code you have shown, although I would suggest not passing the String
parameter to TStringStream's constructor, use an empty string instead. And
you have still not headed by earlier warning about renaming the String
parameter to something else. Other than that, what does your
SaveChartToStream() function actually look like? That is the only piece you
keep leaving out. Is it possible that the string is simply containing null
characters that are somehow truncating your use of the returned string?
Gambit
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (www.grisoft.com).
Version: 6.0.510 / Virus Database: 307 - Release Date: 8/14/03
 

Re:Re: Getting my hands on "DataString"

Hi Remy
humm......
If I change the code like below, it shows that SaveChartToStream works fine,
but I can still not get my hand on the whole string in DataString.
Torben Laursen
bool __fastcall TEqStorage::ChartToString(TChart *Chart, AnsiString &String)
{
TStringStream* pss = new TStringStream(String);
try
{
SaveChartToStream(Chart, pss, true); ///save the chart
Chart->RemoveAllSeries(); ///removes the series in
chart
pss->Seek(0, soFromBeginning);
AnsiString Test1 = pss->DataString; ///Test1 only get to hold a few
letters
LoadChartFromStream(Chart, pss); ///Loads the chart, works fine,
shows that SaveChartToStream works
}
catch(...)
{
delete pss;
return false;
}
delete pss;
return true;
}
 

{smallsort}