Re: Debug Assertion Failure?
On May 25, 1:51 am, Gone With Wind <XinMen...@gmail.com> wrote:
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?
As others have already pointed out, there's not much C++ in
there to go on. Just guessing about what the code does,
wouldn't something like:
for ( int i = 0 ; i < 5 ; ++ i ) {
std::istringstream s ;
s << i ;
shee.m_RibTypeEdit.m_RibNum.AddString(
toCString( s.str() ) ) ;
}
be more what you are looking for. (I'm not too sure about how
to convert a string to a CString, but if CString is some sort of
text string, there's a good chance that CString( s.str().c_str() ), or
even just CString( s.str() ) would do the trick here.)
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34