473,473 Members | 2,170 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

debug assertion error dbgheap.c

I am getting a debug assertion error that reads:

Debug Assertion Failed!

program E:\program files\internet explorer\iexplore,exe
File: dbgheap.c
Line: 1252

Expression: _CrtIsValidHeapPointer(pUserData)

here is my code.

// DEFINE VAIRABLES
CString DataStream;
int DataArray[11];
int iCounter;
string sBuffer;
int pos;
bool bDone;
int m_count;
int nStrPos;
int nLength;
int d = 0;
CString MonitorCaption;
bool GetMoreData = true;

// initial log events variable
if (LogInformation == "TRUE")
{
LogEvents = 0;
}
else
{
LogEvents = -1;
}

// set up interface pointer
CPDSInterface* PDSInterface;

if (PDSInterface != NULL)
{
PDSInterface = NULL;
}

// initialize variables for process
DWORD Error = 0;

if (PDSInterface != NULL)
{
PDSInterface = NULL;
}

PDSInterface = new CPDSInterface();

// establishe iniital connect
d = PDSInterface->Initialize("127.0.0.1");

if (d != SUCCESS)
{
if (LogEvents == 0)
{
CString strMessage("Failured to initialize Monitor");
ErrorLog(strMessage);
}
return;
}

// need to open a connection to the gateway first..
d = PDSInterface->Connect("196.76.0.1");

if (d != SUCCESS)
{
if (LogEvents == 0)
{
CString strMessage("Failured to Connect to Monitor");
ErrorLog(strMessage);
}
return;
}

// clear the buffers
d = PDSInterface->ClearData("196.76.0.1");

if (d != SUCCESS)
{
if (LogEvents == 0)
{
CString strMessage("Failured to clear the buffer of Monitor");
ErrorLog(strMessage);
}
return;
}

// udpdate caption of button
MonitorCaption = m_Caption;
COleControl::SetText(MonitorCaption);
COleControl::RedrawWindow(0,0,RDW_UPDATENOW);

// main loop
try
{
while (GetMoreData)
{
Sleep(1000);
DoEvents();

if (LogEvents == 0)
{
CString strMessage("before datastream");
ErrorLog(strMessage);
}

if (PDSInterface == NULL)
{
CString strMessage("PDSInterface is NULL.");
CString strTitle("TITLE");
MessageBox(strMessage, strTitle, MB_OK);
}

// get data from monitor
d = PDSInterface->GetData("196.76.0.1", DataStream);

if (LogEvents == 0)
{
CString strMessage(DataStream);
ErrorLog(strMessage);
}

if (DataStream == "")
{
CString strMessage("DataStream is NULL");
ErrorLog(strMessage);
}

Sleep(1000);
DoEvents();

if ((d == SUCCESS) && (DataStream != ""))
{

// reset variables
m_count = 0;
pos = 0;
iCounter = 0;
bDone = false;

// convert cstring to string, to be able to work with the string
properties
CT2CA pszConvertedAnsiString (DataStream);
string sWorkString (pszConvertedAnsiString);

// parse data steam into data array
pos = sWorkString.find(' ');

if (LogEvents == 0)
{
CString strMessage("Before Parsing");
ErrorLog(strMessage);
}

if (pos >= 0)
{
nLength = sWorkString.size();
// we have work to do,and we have to do it one character at a time
sBuffer = "";
nStrPos = 0;

do
{
char cCharToAdd = sWorkString.at(nStrPos);

if (cCharToAdd != ' ')
{
//add the character
sBuffer += cCharToAdd;
nStrPos++;
}
else
{
if (sBuffer == "-32767")
{
DataArray[iCounter] = 0;
}
else
{
DataArray[iCounter] = atoi(sBuffer.c_str());
}
iCounter++;
nStrPos++;
sBuffer = "";
}

if (nStrPos >= nLength)
{
bDone = true;

}
} while (!bDone);
}

if (LogEvents == 0)
{
CString strMessage("After Parsing");
ErrorLog(strMessage);
}

// move data to variables
int Systolic = DataArray[1];
int Diastolic = DataArray[2];
int ETCO2 = DataArray[5];
int PulseRate = DataArray[6];
int RespirationRate = DataArray[8];
int SPO2 = DataArray[10];

// Update Web Page
UpdateWebPage(PulseRate, Systolic, Diastolic, SPO2, RespirationRate);
DoEvents();

if (LogEvents == 0)
{
CString strMessage("after web update");
ErrorLog(strMessage);
}

Sleep(1000);
DoEvents();
// write to log
WriteToLog(PulseRate,Systolic,Diastolic,SPO2,Respi rationRate);
DoEvents();
}
if (LogEvents == 0)
{
CString strMessage("before returning to top");
ErrorLog(strMessage);
}
}
}

// catch all errors
catch(...)
{
GetMoreData = false;
}
return;

please help,
Jun 27 '08 #1
0 1843

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

Similar topics

1
by: Kostatus | last post by:
When I close my program and call: delete *iter2; (iter2 being an iterator of a vector which contains pointers to objects) I get a "Debug Assertion Failed!" message (using VC++ 6) with the...
0
by: Chemix | last post by:
Hello people, I've developed a windows forms application with VC++.NET. The problem I have is the next: I run my application and all seems go OK, but passed a certain time (it can be hours or some...
6
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...
2
by: Arti Potnis | last post by:
Hi, I have an application with a function "myfunction" that opens a file and writes to it using fprintf. This application runs on a unix (sun solaris 5.8) system. I connect to this application...
3
by: Ben Schwehn | last post by:
Hello I have a mixed mode c++ dll that i want to use from a c# project. However, I get an debug assertion when the dll is loaded. The assertion is in line 1301 in dbgheap.c in the function ...
4
by: Mullai | last post by:
Hi , My program gives an error message like this Debug Assertion Failed! program:................ File: wincore.cpp Line: 958 Please can anyone help me out in this issue. I have to solve...
5
by: Bruce | last post by:
I am getting a lot of link errors when compiling in the debug build but not release. I am compiling a CLR managed code class library. I believe the link errors are actually being caused by a...
2
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
by: longP | last post by:
Hi I have an application which creates a queue, a thread is putting data in the queue using malloc and another thread is getting data from the queue and delete the memory allocated in the first...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.