|
Hi,
Can anyone tell me what is this exception?
Unhandled exception in mytest.exe(mfc42.dll):0xc00000096 privileged Instruction.
Regards
Neaha
|
|
|
|
|
I believe it usually happens when you are passing invalid parameters to the base classes or you are trying to access data when it hasn't been created yet (invalid data).
|
|
|
|
|
But it is happening at
m_str=new double[256*256];
where m_str is double *
|
|
|
|
|
That line of code looks fine. without looking at the rest of the code around it I don't know for sure.
|
|
|
|
|
By the way, if the array is always made up of 65536 doubles, then why not,
double m_str[65536];
It's much faster and you don't have to worry about freeing it later.
Regards,
Alvaro
Can I ask you a question?
|
|
|
|
|
Yum. A 512Kb allocation. Hope that sucker isn't on the stack....
Steve S
|
|
|
|
|
Are you using SSE or SSE2 by any chance? If you are, I might answer your question.
|
|
|
|
|
When we capture an image, it goes to clipboard. I heard that clipboard accepts DIB and TIFF format(but I'm not sure). If I send JPEG image to clipboard, does clipboard transform JPEG image to DIB or TIFF?
|
|
|
|
|
CF_BITMAP , CF_DIB , and CF_TIFF are three of the standard formats. To register others such as JPEG, you'll need to call RegisterClipboardFormat() .
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I have an array:int amounts[]
How do I define size of arrays as an enumeration literal
Num in an anonymous enumeration?
|
|
|
|
|
Typically when I need to do this I have:
enum Test
{
Item 1
Item 2
.
.
.
Item N
TestEnd
}
then I just use (TestEnd - Item 1) for the size on the array. Just make sure that if you add to the enumeration that TestEnd or whatever you call it is always the last item. This will create a proper sized array.
|
|
|
|
|
Here is my code:
Can you help me?
#include <iostream>
using namespace std;
const NUM = 2;
int volumes[NUM], volume;
int count=0;
int amounts[NUM],amount;
const double price=0.05;
const double fee=12.0;
int main()
{
do
{
cout<<"Please enter the volume of water used by a customer ";
cout<< "during a month (in gallons).(Zero to end):";
cin>>volume;
if (volume==0.0)
break;
if (count==NUM)
break;
volumes[count++]=volume;
amount=(volume*price)+fee;
amounts[count++]=amount;
}
while(true);
return 0;
}
|
|
|
|
|
// include <float.h> and <iostream> in stdafx.h
#include "stdafx.h"
using namespace std;
const NUM = 2;
// changed int to double because volume usually isn't in whole numbers
//int volumes[NUM], volume;
double volumes[NUM], volume;
int count=0;
// use double for amounts because you are using doubles to multiply
double amounts[NUM],amount;
const double price=0.05;
const double fee=12.0;
int main()
{
do
{
cout<<"Please enter the volume of water used by a customer ";
// cout won't get you the value must use cin
//cout<volume;
cin="">> volume;
// with doubles never check for equality, check for greater or
// less than
if (volume < DBL_MIN )
break;
// move this check to the end of the while loop
// and make it check for >= instead of ==
//if (count==NUM)
// break;
// also you are incrementing count twice. only do it once
//volumes[count++]=volume;
amount=(volume*price)+fee;
//amounts[count++]=amount;
volumes[count] = volume;
amounts[count] = amount;
count++;
if( count >= NUM )
break;
}
while(true);
return 0;
}
|
|
|
|
|
Thanks for the comments. It helps a lot.
One more question:
I am trying to display all values after user enters 0. I wrote the following code. I can't see what is incorrect in this code.
displayArray();
void displayArray(const int volumes[NUM];const int NUM)
{
count<<"\n";
int count=0;
while (count
|
|
|
|
|
Also don't forget to predefine the function unless you put the fuction code before main.
displayArray( volumes, count);
// First the Function declaration is incorrect.
// you have a semicolon where there should be a comma
// and you have volumes declared as int when it should be
// double but that was covered previously
// also you don't need NUM as a variable because it is a
// program constant. Instead pass Count
//void displayArray( const int volumes[NUM]; const int NUM)
void displayArray( const double volumes[NUM], const int Count)
{
cout<<"\n";
int nCount=0;
while ( nCount < Count)
{
cout<< volumes[nCount] << " ";
nCount++;
}
int nPause;
cin >> nPause;
}
|
|
|
|
|
Thank you for comments it explains a lot (I am in school )
|
|
|
|
|
Hello, everyone!
How to dump some debug information (I mean the information of my special program information, for example, the value of a variable which I am interested in) to VC 6.0's debug window in a MFC project? Who can show me an example?
Thanks in advance,
George
|
|
|
|
|
afxDump << nVar;
afxDump is the stream that outputs to the debug window in the Visual Studio IDE. It works in both 5.0, 6.0 and .NET.
|
|
|
|
|
Thanks, Adam buddy!
George
|
|
|
|
|
Search MSDN for the TRACE() macros.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Thanks, DavidCrow buddy!
George
|
|
|
|
|
A good utility for using the trace functionality in your application so that you can also send to a different viewer (for more real time debugging) go here http://www.dilascia.com/
and get the Trace Win app.
|
|
|
|
|
Thanks, Adam buddy!
George
|
|
|
|
|
Hi All,
How can I implement in VC++ a function like VB CreateObject Function.
I've make a Dll in VB with 3 classes how can I invoke those classes in VC++
Thank in Advance
CM
Carlos Mariano
|
|
|
|
|
Hy,
i hope somebody can help me to solve my problem.
I have a laptop and a lan network at my company and a lan network
at home.
At home i have a static ip address for my laptop ,
at company the ip address is given dynamicly.
I would like to write a little tool to change the ip address
and the setting how to receive the ip address,
to make the change more comfartable for me.
I know there exist some tools to do exactly this, but i want to
solve this problem on my own.
Now i am searching for examples or the orders to implement my tool,
because i do not find them until now.
I am very thankful for every advice.
Thanks
Micha
|
|
|
|