On May 25, 1:51 am, Gone With Wind <XinMen...@gmai l.comwrote:
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_RibType Edit.m_RibNum.A ddString((LPCTS TR)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::istringstr eam s ;
s << i ;
shee.m_RibTypeE dit.m_RibNum.Ad dString(
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:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34