473,972 Members | 50,218 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Debug Assertion Failure?

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?
Jun 27 '08 #1
2 2478
Gone With Wind 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_RibType Edit.m_RibNum.A ddString((LPCTS TR)s);
}
You'd have better luck on a windows group, none of those functions or
classes are standard C++.

--
Ian Collins.
Jun 27 '08 #2
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
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3179
by: Todd Miller | last post by:
Hi, I recently discovered an assertion failure in the Python garbage collection system when scripts using our C extension (numarray) exit. The assertion is activated for Pythons configured using --with-pydebug. I have a feeling I may be doing something wrong with garbage collection support for some of our c types, but I'm not sure exactly what. Here is the assertion output:
6
595
by: Cormac | last post by:
Hi everyone, I'm writing Pure Data externals in C++ using Ms Visual C++ 7.0 and Windows2000. I'm running motions sensor hardware so there's a bit of real time data processing involved. When I'm running my objects in Pure Data, I get an assertion failure after a few seconds of running the motion sensors and I can't seem to get rid of it. The error occurs in the expression _CrtCheckMemory(). Could anyone provide some possible solutions?
0
1695
by: Guohui He | last post by:
Hi All, I am trying to update our application from VC 6.0 to VC 7.1 (.NET 2003) as managed extension. Now the compilation seems to be fine and the release version works also. However, when I run the debug version, I always get an error: Debug Assertion Failed! File: f:\vs70builds\3077\vc\MFCATL\ship\atlmfc\include\afxwin1.inl Line: 26
0
2973
by: lawrence | last post by:
Hi, I made a MFC ActiveX with a CwinThread Class in VC ++. Then i used it on Visual basic. When i try to make an exe i got this error : Debug Assertion Failed! Program: C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VB98\VB6.EXE File: cmdtarg.cpp Line: 52
9
2341
by: Bern McCarty | last post by:
I am porting stuff from MEC++ syntax to the new C++/CLI syntax. Something that we did in the old syntax that proved to be very valuable was to make sure that the finalizer would purposefully generate an assertion failure for unoptimized, debug builds. We did this to find and fix cases where we were relying upon finalization rather than pro-active Dispose() calls. For classes that introduced IDisposable() into the class hierarchy...
2
5590
by: Pushpa | last post by:
Hi All, This my part of the c++ program using threads in windows : //modified by pushpa struct structExrdDoc { CExrdDoc* spDoc; LPCTSTR sstrFileName;
2
3419
by: rsr | last post by:
hi, I am unable to execute my application though I am able to build and compile it without warnings or errors, because of this. Debug Assertion failure file tcscat_s.inl line: 42 can anyone tell me what does this mean?
22
3110
by: kudruu | last post by:
Hello, I am having a problem in Microsoft Visual C++ with some code I have written (I am a bit of a novice so I appologize if this is a very mundane problem). This is a segment from one of the functions I am using. I am trying to get a user to input whether they want an output file or not and if they do to specify the name. Output_File is a global char. Maybe there is a better way to do this, nonetheless, it compiles with a LNK4075...
1
1880
by: aalam | last post by:
class base { int a; base(int x) { a=x; } ~base(); } class derive:public base
0
10346
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10159
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11805
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
11555
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10900
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
10067
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8451
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6402
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
5143
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.