Click here to Skip to main content
16,007,760 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How Do I Get The Applications Name? Pin
Paul M Watt10-May-02 7:51
mentorPaul M Watt10-May-02 7:51 
GeneralRe: How Do I Get The Applications Name? Pin
Matt Gullett10-May-02 7:54
Matt Gullett10-May-02 7:54 
GeneralRe: How Do I Get The Applications Name? Pin
Paul M Watt10-May-02 9:37
mentorPaul M Watt10-May-02 9:37 
GeneralRe: How Do I Get The Applications Name? Pin
Neil scsn10-May-02 10:16
Neil scsn10-May-02 10:16 
GeneralRe: How Do I Get The Applications Name? Pin
Paul M Watt10-May-02 11:14
mentorPaul M Watt10-May-02 11:14 
AnswerRe: How Do I Get The Applications Name? Pin
Ravi Bhavnani10-May-02 8:00
professionalRavi Bhavnani10-May-02 8:00 
GeneralAPI "Clean Up" Functions & delete Pointers :: Winsock Pin
valikac10-May-02 7:30
valikac10-May-02 7:30 
GeneralRe: API "Clean Up" Functions & delete Pointers :: Winsock Pin
James R. Twine10-May-02 9:52
James R. Twine10-May-02 9:52 
sock *mySocket = socket(...);
Now I close it.
closesocket(*mysocket);
Now, should I still call delete mySocket afterward?


   Nope.  socket(...) does not return a (direct) pointer to something it returns a socket descriptior that you use to reference the created endpoint in the future.

   Since you did not directly allocate any memory (using new), you should not be so hasty to delete it.  Also, you should not be passing socket pointers to those functions.

In the case of a struct inaddrinfo, you pass in a pointer [...]

   Just because something takes a pointer as a parameter, that does not mean that you automatically are required to dynamically allocate something.  You can create a inaddrinfo on the stack, and pass in its address to whatever functions takes a pointer-to-a-inaddrinfo structure.

In the case of WSAData, do you delete the pointer to a WSAData structure after calling WSACleanup()?

   Only if you actually allocated the WSADATA structure earlier.  If you just created one on the stack, and passed its address to WSAStartup, the structure will go out of scope automatically.

   Peace!

-=- James.
"Fat people are hard to kidnap."
(Try Check Favorites Sometime!)
GeneralRe: API "Clean Up" Functions & delete Pointers :: Winsock Pin
valikac10-May-02 10:52
valikac10-May-02 10:52 
GeneralRe: API "Clean Up" Functions & delete Pointers :: Winsock Pin
James R. Twine10-May-02 11:07
James R. Twine10-May-02 11:07 
GeneralRe: API "Clean Up" Functions & delete Pointers :: Winsock Pin
valikac10-May-02 11:18
valikac10-May-02 11:18 
GeneralResizing windows Pin
Stew10-May-02 6:48
Stew10-May-02 6:48 
GeneralRe: Resizing windows Pin
l a u r e n10-May-02 6:54
l a u r e n10-May-02 6:54 
GeneralRe: Resizing windows Pin
Stew10-May-02 7:10
Stew10-May-02 7:10 
GeneralRe: Resizing windows Pin
Paul M Watt10-May-02 7:44
mentorPaul M Watt10-May-02 7:44 
Generalusing CTabCtrl with CListCtrl Pin
10-May-02 5:54
suss10-May-02 5:54 
GeneralVisual C++ 6 Add-ins Pin
Derek Lakin10-May-02 5:21
Derek Lakin10-May-02 5:21 
GeneralRe: Visual C++ 6 Add-ins Pin
Neville Franks11-May-02 13:03
Neville Franks11-May-02 13:03 
GeneralRe: Visual C++ 6 Add-ins Pin
Derek Lakin11-May-02 23:02
Derek Lakin11-May-02 23:02 
GeneralRe: Visual C++ 6 Add-ins Pin
Neville Franks12-May-02 11:17
Neville Franks12-May-02 11:17 
GeneralRe: Visual C++ 6 Add-ins Pin
Derek Lakin12-May-02 19:56
Derek Lakin12-May-02 19:56 
GeneralCPropertyPage bitmaps Pin
moobob10-May-02 5:27
moobob10-May-02 5:27 
GeneralRe: CPropertyPage bitmaps Pin
James R. Twine10-May-02 10:00
James R. Twine10-May-02 10:00 
GeneralRe: CPropertyPage bitmaps Pin
moobob13-May-02 3:43
moobob13-May-02 3:43 
GeneralRe: CPropertyPage bitmaps Pin
James R. Twine13-May-02 13:34
James R. Twine13-May-02 13:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.