|
Deepu Antony wrote: delete * p;
It's like:
delete p;
Deepu Antony wrote: Whether pointer q is also created on the heap.
Nope, heap allocation occurs only when you use any of the heap allocation functions (new , calloc , malloc , etc.,)
Deepu Antony wrote: Is q = NULL is correct?
No. q has the address of the variable a . And can be pointing to some random value if you hadn't assigned it like that.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Deepu Antony wrote: Whether pointer q is also created on the heap.
If so how to delete it?
Is q = NULL is correct?
No, q is not allocated on the heap. It just contains the address of a, you didn't allocate anything for it. Keep in mind a very simple rule: for each call to new, you should have a matching delete. No more, no less. In this case, you have one single new (for the p pointer), so you have to call delete on this pointer, and that's it.
|
|
|
|
|
|
Deepu Antony wrote: Whether pointer q is also created on the heap.
If so how to delete it?
If the momory pointed by q (pointers are ususally created on the stack) is created on the heap then you must use delete.
Deepu Antony wrote: Is q = NULL is correct?
Again, when q points heap-allocated memory you've to delete it. Invalidating the pointer afterward is a good pactice (for instance):
int * q;
q = new int[10];
if (q) delete [] q;
q = NULL;
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
If you delete memory, which you didn't allocate dynamically, you surly putting yourself in trouble.
Remember simple rule, you only need to delete the memory, which is you allocate to the program!
<blockquote class="FQ"><div class="FQA">Deepu Antony wrote:</div>Is q = NULL is correct?</blockquote>
yes!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hello!
There are LsaEnumerateLogonSessions and LsaGetLogonSessionData functions which can be used to get information about the logon sessions.
But is there a way to enumerate the users that are NOT logged on?
Thanks in advance!
|
|
|
|
|
Thinking about what you're asking...
There's local users...
There's users of domain AAAA - which would require lots of traffic...
There's users of domain BBBB - which would require lots of traffic...
There's users of domain CCCC - which would require lots of traffic... oh, and this domain server is in Mongolia. Their head office guy is visiting this week.
And so on.
So, I strongly doubt it!
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!
|
|
|
|
|
Eikthrynir wrote: But is there a way to enumerate the users that are NOT logged on?
Such as NetUserEnum() ?
"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 think this is what I have been looking for. Thanks a lot!
|
|
|
|
|
are you talking about single computer or domain?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Single computer.
Anyway, I that NetUserEnum does the job.
|
|
|
|
|
Hi,
I want my ownerdrawn Controls, to look in the correct way.
But if call IsThemeActive() on XP I get always "TRUE", what do I wrong?
The standardcontrols look differen, wheter I have an .exe.manifest or not.
What have I to do, so that my ownerdrawn controls are drawn correctly?
|
|
|
|
|
Hai!
I have an MFC application. i build it in both release and debug build. it generates an .exe file. Can i get the name of this .exe programmatically.
within my application.
what i actually need is the name of the exe. If it has been renamed manually then i need the changed name
Thanks!
|
|
|
|
|
See GetModuleFileName()[^]
Usage:
TCHAR szPath[_MAX_PATH];
GetModuleFileName(NULL, szPath, _MAX_PATH);
AfxMessageBox(szPath);
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hey kid, you're too fast (and actually complete).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Well, you just need a faster internet connection.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
You're are wrong: I need a faster neuron connection
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Actually, I have ten monkeys (me not included) to assist me search MSDN. Because, I only have paper-printed version. They're like FASSTTT... You know?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
I guess this is good enough to start the new quarter [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Me and the monkeys on the same line... Now, that's a honor.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
need 11th?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
As a matter of fact, *I am* the 11th one.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Good!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
CPallini wrote: I need a faster neuron connection
Yeah, because 22 mintues to write a two lines reply is a looooong time
|
|
|
|
|
I didn't get you. Actually I'm still interpreting "Yeah"...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|