we have upgrade our BCB from 5.00 to 6.00. Now we have a big problem with
the function AnsiString::sprintf. If we use empty strings in this function
there is always following Message: EAccessViolation - writing from adress
00000000 !
Sample
String as,as1;
as1 = "";
as.sprintf("%s",as1.c_str()); // here is the Exception
or
as.sprintf("%s",""); // here is the Exception as well
Thanks in advance
Andreas
Gambit
"Andreas Osswald" <a.os...@ratio-elektronik.de> wrote in message
news:3cecc558_2@dnews...
Andreas
Remy Lebeau [TeamB] <gamb...@yahoo.com> schrieb in im Newsbeitrag:
3ced555d$1_1@dnews...
Gambit
"Vladimir Zhuchko" <zhu...@lnr.jinr.ru> wrote in message
news:98qreu4sbsr7cu71a...@4ax.com...
> I am using, without problems.
With best regards
Vladimir E. Zhuchko
I doubt it, but who knows for sure.
> All of the users of BCB 6 must have this problem.
It wouldn't be the first seemingly obvious bug that made it through the BCB6
testing phases undetected.
> Am I rigth the we have to change all of our Projects to replace the
> sprintf Function (several mille locations)?
Apparently so, at least until a patch can be released. The bug is in
AnsiString itself, it's not something we can fix ourselves as we can't
recompile the VCL.
> Or is there a quick solution in view ? Or should we give back the
> BCB 6.0 Version and reconvert to the BCB 5.00 ? What shall we do ?
In the interim, you can always do something like the following:
AnsiString as, as1;
if(!as1.IsEmpty())
as.sprintf("%s", as1.c_str());
else
as = "";
Gambit
> Are we the only one, who use the AnsiString::sprintf function ?
>
We use it a lot..a heck of a lot. We haven't had any problems so far
though (I can reproduce your bug however).
Andrue Cope
[Bicester, UK]
Team Thai Kingdom
Thanks for your direct answers.
Is there any prognosis possible to say in wich period the patch is coming
out (days/weeks/months)? The point is shall we change over our Projects.
Andreas
Remy Lebeau [TeamB] <gamb...@yahoo.com> schrieb in im Newsbeitrag:
3cedeae9$1_2@dnews...
Gambit
"Andreas Osswald" <a.os...@ratio-elektronik.de> wrote in message
news:3cee0dc9_1@dnews...
I think my colleague has locate the problem. It is in the AnsiString class
(dstring.cpp) in the function vprintf in line 358:
int _cdecl AnsiString::vprintf(const char* format, va_list paramList)
{
int size = vsprintf(NULL, 0, format, paramList);
SetLength(size);
return vsnprintf(Data, Size + 1, format, paramList);
// in older edition愀 it was:
return vsnprintf(Data, Size, format, paramList); // without +1 in the
Size parameter
}
so if I delete the +1 in vsnprintf and add the dstring.cpp unit to my
project, it works pretty good.
Andreas
Remy Lebeau [TeamB] <gamb...@yahoo.com> schrieb in im Newsbeitrag:
3ced555d$1_1@dnews...
"Andreas Osswald" <a.os...@ratio-elektronik.de> wrote in message
news:3cf233b0_1@dnews...
Andreas
Pete Fraser <pete....@at.frasersoft.dot.net> schrieb in im Newsbeitrag:
3cf25f32$1_2@dnews...
> Are you going to log this in QualityCentral?
> Pete
>
> "Andreas Osswald" <a.os...@ratio-elektronik.de> wrote in message
> news:3cf233b0_1@dnews...
> > Hello,
> >
> > I think my colleague has locate the problem. It is in the AnsiString
class
> > (dstring.cpp) in the function vprintf in line 358:
> >
> > int _cdecl AnsiString::vprintf(const char* format, va_list paramList)
> > {
> > int size = vsprintf(NULL, 0, format, paramList);
> > SetLength(size);
> > return vsnprintf(Data, Size + 1, format, paramList);
> > // in older edition´s it was:
Gambit
"Andreas Osswald" <a.os...@ratio-elektronik.de> wrote in message
news:3cf31825_2@dnews...