Click here to Skip to main content
15,900,906 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to develop an XML file using VC++ [modified] Pin
Nibu babu thomas22-May-07 20:15
Nibu babu thomas22-May-07 20:15 
AnswerRe: How to develop an XML file using VC++ Pin
Cedric Moonen22-May-07 20:19
Cedric Moonen22-May-07 20:19 
GeneralRe: How to develop an XML file using VC++ Pin
kunal.tawde22-May-07 22:40
kunal.tawde22-May-07 22:40 
AnswerRe: How to develop an XML file using VC++ Pin
Hamid_RT22-May-07 21:05
Hamid_RT22-May-07 21:05 
GeneralRe: How to develop an XML file using VC++ Pin
kunal.tawde22-May-07 22:43
kunal.tawde22-May-07 22:43 
GeneralRe: How to develop an XML file using VC++ Pin
Hamid_RT22-May-07 23:39
Hamid_RT22-May-07 23:39 
QuestionPassing a pointer to a function/dynamic memory allocation Pin
hpjchobbes22-May-07 19:44
hpjchobbes22-May-07 19:44 
AnswerRe: Passing a pointer to a function/dynamic memory allocation Pin
Cedric Moonen22-May-07 19:58
Cedric Moonen22-May-07 19:58 
hpjchobbes wrote:
My function works, but the problem comes from the calling function. If I create a pointer to a FooStruct and pass that, it does not get updated with the address that the new comes back with. I still don't fully grasp pointers (just the basics) so I may be going about this the wrong way.


That is the standard behavior. To make things easier, see pointers as being a value (the value is the address of a certain memory area). Thus you are in fact passing a value to a function, and the function will make a copy of this value for itself. You create a new array and you store this new value in the copy. Thus, your calling function will never be updated.

To solve this 'problem', pass the pointer by reference. This instruct your function that it must work on the variable and not make a copy of it:

int GetFooList(FooStruct* &pFoos)


Cédric Moonen
Software developer

Charting control [v1.2]

AnswerRe: Passing a pointer to a function/dynamic memory allocation Pin
cmk22-May-07 20:02
cmk22-May-07 20:02 
AnswerRe: Passing a pointer to a function/dynamic memory allocation Pin
Arman S.22-May-07 20:04
Arman S.22-May-07 20:04 
AnswerRe: Passing a pointer to a function/dynamic memory allocation Pin
zhang80060522-May-07 20:34
zhang80060522-May-07 20:34 
AnswerRe: Passing a pointer to a function/dynamic memory allocation Pin
David Crow23-May-07 4:21
David Crow23-May-07 4:21 
AnswerRe: Passing a pointer to a function/dynamic memory allocation Pin
hpjchobbes23-May-07 5:03
hpjchobbes23-May-07 5:03 
Questionmenu change for child window Pin
prithaa22-May-07 19:40
prithaa22-May-07 19:40 
AnswerRe: menu change for child window Pin
Anurag Gandhi22-May-07 19:48
professionalAnurag Gandhi22-May-07 19:48 
GeneralRe: menu change for child window Pin
prithaa22-May-07 21:11
prithaa22-May-07 21:11 
Questionerror in a very simple VC++ program Pin
tyagineha22-May-07 19:09
tyagineha22-May-07 19:09 
AnswerRe: error in a very simple VC++ program Pin
Anurag Gandhi22-May-07 19:33
professionalAnurag Gandhi22-May-07 19:33 
GeneralRe: error in a very simple VC++ program Pin
tyagineha22-May-07 20:06
tyagineha22-May-07 20:06 
GeneralRe: error in a very simple VC++ program Pin
Hamid_RT23-May-07 6:17
Hamid_RT23-May-07 6:17 
AnswerRe: error in a very simple VC++ program Pin
Sarath C22-May-07 19:41
Sarath C22-May-07 19:41 
AnswerRe: error in a very simple VC++ program Pin
tyagineha22-May-07 23:32
tyagineha22-May-07 23:32 
GeneralRe: error in a very simple VC++ program Pin
Sarath C22-May-07 23:54
Sarath C22-May-07 23:54 
AnswerRe: error in a very simple VC++ program Pin
tyagineha23-May-07 0:24
tyagineha23-May-07 0:24 
GeneralRe: error in a very simple VC++ program Pin
Sarath C23-May-07 0:26
Sarath C23-May-07 0:26 

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.