473,372 Members | 989 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

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 1836

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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.