|
Urgh!!!
Did you read my post?
Of course delete[] should be used after new[]. However, it WORKS (with VC 6.0 both debug and release) even without [], out of luck or not. It does not mean you should ever do this, but it works, and that's all I wanted to say.
I vote pro drink
|
|
|
|
|
You are right.
Check my message. It makes a HUGE difference since invoking 'delete' on an array is undefined. I have seen it crash in release builds many times.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Interesting. I was all ready to post wondering what the heck you were talking about, "calls destructors for all the objects in an array"... sounds like Java to me. But I double-checked and found you are indeed correct.
However, according to my copy of C++PL, "The effect of deleting an array with the plain delete syntax is undefined, as is deleting an individual object with the delete[] syntax." So it sounds like Microsoft just decided to do it their own way.
J
|
|
|
|
|
It works with MS out of luck. I have had many programs crash due to this error by the programmer, with VC when in release mode.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Jamie Hale wrote:
Interesting. I was all ready to post wondering what the heck you were talking about, "calls destructors for all the objects in an array"... sounds like Java to me. But I double-checked and found you are indeed correct.
However, according to my copy of C++PL, "The effect of deleting an array with the plain delete syntax is undefined, as is deleting an individual object with the delete[] syntax." So it sounds like Microsoft just decided to do it their own way.
Exactly. Maybe there are too many programmers who forget []
I vote pro drink
|
|
|
|
|
First, clean up your lack of deallocations as others have stated. However, the bad news is that there is little chance doing that will fix the problem.
But, maybe by freeing up the memory, those strings will be forced to trash values while in debug mode and it might help you find the problem.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
So I guess the question is. Why would I want to bother setting and deleting a pointer to an address space, which is storing characters, when I could let the operating system do this for me by just setting the my char variables like this
char StringBuf[32400];
I mean basically if I look at the class for CString.......won't I see that it is setting my StringBuf to a char array with a variable size?
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
for ( numOfLines =0; numOfLines < 15; numOfLines ++)
{
cin>>tempCN>>tempST>>tempMT>>tempTM>>tempIV>>tempNS;
(*tempStock).setCompanyName(tempCN);
(*tempStock).setStockTicker(tempST);
(*tempStock).setMarketTraded(tempMT);
(*tempStock).setTypeOfManufactr(tempTM);
(*tempStock).setInitialValue(tempIV);
(*tempStock).setNumOfOutShares(tempNS);
cout<< (*tempStock).getCompanyName()<<" "<< (*tempStock).getStockTicker()<<" " <<(*tempStock).getMarketTraded()<<" " <<(*tempStock).getTypeOfManufactr()<<" "<< (*tempStock).getInitialValue()<<" "<<(*tempStock).getNumOfOutShares()<< endl;
this piece of code prints all those elements but the 4th one,
any ideas why
thank you
|
|
|
|
|
Step 1. Do not mail me directly with a request, post it here. Thats just rude. What if I was on the toilet or something.
Step 2. Lose the (*tempStock). thing. if tempStock is a class pointer, then get to its members by referencing them like this: tempStock->setCompanyName .
Step 3. Use the debugger. I would think that either one of your set* functions or one of your get* functions is screwed. trace through, step by step, and see where the data goes missing.
Step 4. If, and only if, you are still stuck, having tried tracing through with the debugger, then provide enough information for people to help you. To me, "4th Element" is one before a crap film. Which element? is it tempTM & setTypeOfManufactr???? if it is, say so. Also, it'd probably be useful to actually post the code for the set and get functions in question.
Remember to post your code inside of <PRE> ... </PRE> tags, so that formatting is preserved.
Jon
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
How do you do this sort of thing?
I have two projects in mind.
1) write a better xfer program for my MP3 player than the one supplied with it
2) talk to devices of my own design via the USB
What I would like to know is how does one go about chatting to a device on the USB port.
Are there any utilities that can monitor the data that is transferred on the USB?
I want to know what the xfer program sends and recieves from the MP3 player.
Paresh Solanki
One Tequila Two Tequila Three Tequila Floor
five Tequila, six Tequila seven Tequila more
|
|
|
|
|
This would be advanced stuff. The USB driver itself is a kernel mode driver.
To monitor operations you would probably have to write an upper level filter driver on top of the functional driver supplied for your MP3. This may exist somewhere, dunno.
Just thought I'd share my own frustration with the whole API with someone
|
|
|
|
|
Hi,
I have a problem using msmask32.ocx and msflxgrid.ocx.
I'm using it in an application under VC++ 6, which has an editbox using mask. But to get or set the text of the edit, an error occurs.
If someone can help, please.
Thanks.
Otávio
otavio.romao@inatel.br
|
|
|
|
|
Hi,
When I try to connect to a remote computer with WMI between WinXP German edition and WinXP English it always returns "access is denied", between two english WinXP or two German WinXP computers it connects without problems. Does anyone know what's the problem ?, is it a bug in WinXP/WMI ? or I am doing something wrong?
Thanks!
Best Regards,
Mario M.
|
|
|
|
|
Can someone show me how to encrypt and decrypt with MD5??
I don't understand the classes!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
MD5 is for producing a hash (or checksum). It does not do encryption/decryption.
Joel Lucsy (jjlucsy@ameritech.net)
|
|
|
|
|
See the Crypt* functions from the CryptoAPI in Windows
|
|
|
|
|
Hi all, I'm hoping that someone knows how to specify a frame that is always active in an mdi app? I want it so that even if a child window is activated, the other frame (linked to different document type) is not deactivated (so that the title bar does not change colour from dark blue to light blue)? Any ideas would be well appreciated. At the moment I create my frames indirectly through a document template if that helps.
Many Thanks,
Alan.
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
I believe that only one MDI child can be active at a time. If you want a frame window that's always active create it with the desktop as parent window. Dont make it a child of the MDI frame. Even then though it will be on top and visible, it wont be active if some other window is active.
Nish
p.s. Under normal Windows OS rules only one window will be active.
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Yeah thats the thing, I've been at this for ages and can't get it to go. I've managed to create a frame thats on top, does everything I want, except stay active. I am sure this can be done (somehow) cos if you look at VC++ you can detach the workspace pane into a tool window which remains active despite an mdi child window (a .cpp or .h file) being active. Try it out, that is exactly what I want it to do. If it gives you any further ideas give us a shout. Thanks for looking at my problem though nish, much appreciated.
Many Thanks,
Alan.
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
Well, when you un-dock some of the VS windows, they do appear with a blue title bar, but this does not mean they are active windows. I believe they custom-draw their title bars somehow. I am not very sure about this though.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Maybe creating each frame on a different UI thread? This poses all sorts of deadlock problems, however.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Well, I've finally done it. All you have to do is override the OnActivate() function in the CFrameWnd class and have it pass true to MFC's activation function so that :
CFrameWnd::OnActivate(true, this, 0)
As soon as I did this it worked no problems, just thought I'd let you guys know and say thanks for your ideas and responses.
Many Thanks,
Alan.
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
Alan Chambers wrote:
CFrameWnd::OnActivate(true, this, 0)
I am surprised that worked
The first argument is actually a state which can be one of WA_INACTIVE, WA_ACTIVE or WA_CLICKACTIVE.
And you have passed true.
Anyway good for you
Nish
p.s. By the way this only stops them from going un-blue. The fact that only one window will be focally active remains.
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Using ImageMagick (www.imagemagick.org), I now want not only to load, convert and store images, but also display them in an Windows window (i.e. its Device Context DC).
On the page http://www.simplesystems.org/ImageMagick/Integration/ there are two packages (WinExt and DisplayUsingCDib2) mentioned. But the first is using an outdated version of ImageMagick and the second link is dead.
Question: has anyone successfully tried to display an ImageMagick image inside a Windows window and can contribute a small code-snippet or even a complete function like e.g.
void DrawImageToDC( Magick::Image src, HDC dst_dc )
--
See me: www.magerquark.de
|
|
|
|
|
I believe from memory we did it by creating a DIBSection and using memcpy to copy the bits into it. Then we drew that.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|