|
cool thanks a mill for responding....i don't know much about malloc (tho we did touch on it in class)....
thing is the loop in working and it's sending the amount of freq but not the values...i have the array set at [44] so the user shouldn't go out of bounds....so your saying this won't work ...is there any other way?? ie without using malloc...assignment is in at 4 today so i don't have time to look into how malloc functions ....what i have should be enough but would be better if i could get it to play multiple freqs .... thanks again
|
|
|
|
|
If you want a dynamic array, I suggest you take a look at a std::vetor.
|
|
|
|
|
hey i have the std::vector function but what do i need to access it ie where does <pre> #include <vector> </pre> come from? do i need to download something??
|
|
|
|
|
Jacavienna wrote: std::vector function
It's not a function, it's a class (template).
You have to #include <vector> . Here[^] is a small guide to get you started with the STL. If you are still stuck after that, try googling for vector tutorials.
|
|
|
|
|
Jacavienna wrote: how do i incurment the array as the number changes??
array[l]
Check out the subscript operator.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
i need a application which carry all desktop setting means folder and files ,
which carry my documeunt and any personal data and go to any guest pc and do any updation there and come back in you pc and sync and you found all updation there .give a sample like that
or can any body help me
|
|
|
|
|
How much are you ready to shell out of your pocket?
AshNis wrote: i need a application which carry all desktop setting means folder and files ,
which carry my documeunt and any personal data and go to any guest pc and do any updation there and come back in you pc and sync and you found all updation there .give a sample like that
wow! the application goes to guest pc, does the updation and come back to your pc.... interesting
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Live Mesh[^]
May be of use to you! I've not used it myself, but I hear good things about it...
Or a memory stick?
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
Hi,
I have created CStatic object in my MFC application.I have allocated memory to it.If I delete static variable It is giving breakpoint.I am unable to delete CStatic object.Can anyone help me.
|
|
|
|
|
What do you mean by "It is giving breakpoint"? Do you mean that it is failing an ASSERT? If yes, where and what?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
It is showing corruption of heap.
|
|
|
|
|
So you created a static like this: mystatic = new CStatis; , and deleted it like this: delete mystatis; and you get something like "the heap around whatever has been corrupted"?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
I have created member variable CStatic *m_myStatic ;,I am allocating memory like this m_myStatic = new CStatic[m_filecount];, and I am deleting in destructor.It is showing breakpoint is due to corruption of heap.
|
|
|
|
|
How are you deleting it ?
like this : delete [] m_myStatic;
This signature was proudly tested on animals.
|
|
|
|
|
I see, well, you need to delete an array -as Maximilien already pointed out- like this: delete []m_myStatic; . Otherwise, heap corruption can be caused by indexing out of your array, so you try to write items in the array which are not in the array at all, for example:
int *int_array = new int[5];
int_array[10] = 4;
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
This is not related at all. How you use an array has nothing to do with how you destroy it.
|
|
|
|
|
He said he gets "corruption of heap", that -as far as i know- can be caused by what i said there. The question wasn't specifically "how to delete an array".
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Code-o-mat wrote: He said he gets "corruption of heap"...
When he deletes, not accesses.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Correct me when i am wrong but -at least in debug- when you allocate an array using new, the system will allocate somewhat more bytes than explicitly needed by your array and will place some special information infront and after your block. When you delete the array the system will check these special values infront and after the array and if it does not find what it expects it will complain about it because this probably means you wrote to memory you should not have written to. True, the example there was a bad one, i should have wrote int_array[5] = 4; instead of int_array[10] = 4; , because 10 is WAY after the lest element of the array...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
How unbelievable it might seem, there are even more ways to corrupt a piece of memory than there are unspecific questions on this forum
|
|
|
|
|
Lol! My bad! I was reading your 'Otherwise' as 'if you don't delete scalar you will get memory corruption'.
|
|
|
|
|
Guess i should express myself more clearly, sorry...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Hi
We have a MFC Application in which we decide to perform a task based on the mouse click position.
We have a formula that converts this x and y value info into a index number,which we use to retrieve info
Now our customer have given us a crash dump in which CPoint x and y value has 5882 and 1150 which are very huge. Due to which the index generated is very high and since this index does not exists we get a crash(segmentation fault)
In our test we never get such high x and y value.
Can anyone explain the reason for this high x and y values?
Does resolution impact the x and y values?
thanks in advance
from
nayeem khan
|
|
|
|
|
nayeemkhan wrote: Can anyone explain the reason for this high x and y values?
nayeemkhan wrote: We have a formula that converts this x and y value info into a index number,which we use to retrieve info
I've got no idea...but I can suggest a way in which you can stop the crashes. Either validate your input data (you can find the screen extents easily enough - it makes sense that the mouse position should be on-screen?) or validate the index you've generated from the mouse position.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi Stuart Dootson
Thanks for the reply
I have already coded the validation of x and y (which u suggested)
But i was wondering how can a resolution of screen can be such huge 5800x1150.
I am also investigating with respect to data limits of x and y.
Can we get a boo/tutorial which explains exactly how CPoint structure gets the x and y values?
from
nayeem khan
|
|
|
|