Click here to Skip to main content
15,922,630 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: change hex string ? Pin
rocky_pulley14-Feb-05 9:47
rocky_pulley14-Feb-05 9:47 
AnswerRe: change hex string ? Pin
David Crow14-Feb-05 10:01
David Crow14-Feb-05 10:01 
GeneralDirect3D 8.0 question Pin
Bob Ciora14-Feb-05 9:14
Bob Ciora14-Feb-05 9:14 
GeneralATL Dialog in ATL COM with MFC support Pin
peterchen14-Feb-05 8:34
peterchen14-Feb-05 8:34 
GeneralWeird pointer behavior Pin
K. Shaffer14-Feb-05 6:32
K. Shaffer14-Feb-05 6:32 
GeneralRe: Weird pointer behavior Pin
Michael Dunn14-Feb-05 7:06
sitebuilderMichael Dunn14-Feb-05 7:06 
GeneralRe: Weird pointer behavior Pin
Maximilien14-Feb-05 7:06
Maximilien14-Feb-05 7:06 
GeneralRe: Weird pointer behavior Pin
rocky_pulley14-Feb-05 7:06
rocky_pulley14-Feb-05 7:06 
Why should it not be null? That's what you set it at. Passing the address of the pointer can make it modify it but just passing the pointer itself won't modify it. Let me explain.

See the code and the two functions below. Since you are not giving the address of the pointer to the first one, the pointer is not changing from null, it is only valid inside of your function.

char *sz = NULL;
func1(sz);
//sz is still null here.
func2(&sz);
//ok now sz is changed.

func1(char *sz)
{
sz = new char[1024];
strcpy(sz, "blah");
}

func2(char **sz)
{
*sz = new char[1024];
strcpy(*sz, "blah");
}

This is probably what you want your code to do:

CApproach approach; //notice, not a pointer.
GetNextApproach(&approach);



-- Rocky Dean Pulley
GeneralRe: Weird pointer behavior Pin
K. Shaffer14-Feb-05 7:50
K. Shaffer14-Feb-05 7:50 
GeneralRe: Weird pointer behavior Pin
K. Shaffer14-Feb-05 7:55
K. Shaffer14-Feb-05 7:55 
GeneralRe: Weird pointer behavior Pin
Maximilien14-Feb-05 8:38
Maximilien14-Feb-05 8:38 
GeneralRe: Weird pointer behavior Pin
TFrancis14-Feb-05 8:52
TFrancis14-Feb-05 8:52 
GeneralRe: Weird pointer behavior Pin
Christian Graus14-Feb-05 15:02
protectorChristian Graus14-Feb-05 15:02 
GeneralSplitting with the existance of COutlook2Ctrl Pin
Mohammad Tarik14-Feb-05 6:10
Mohammad Tarik14-Feb-05 6:10 
GeneralRe: Splitting with the existance of COutlook2Ctrl Pin
rocky_pulley14-Feb-05 7:35
rocky_pulley14-Feb-05 7:35 
GeneralRe: Splitting with the existance of COutlook2Ctrl Pin
Mohammad Tarik14-Feb-05 12:18
Mohammad Tarik14-Feb-05 12:18 
Generali want to create my own takbar... Pin
14-Feb-05 5:33
suss14-Feb-05 5:33 
GeneralRe: i want to create my own takbar... Pin
rocky_pulley14-Feb-05 7:36
rocky_pulley14-Feb-05 7:36 
GeneralRe: i want to create my own taskbar... Pin
jaisri_g15-Feb-05 4:05
jaisri_g15-Feb-05 4:05 
GeneralSetting up multiple-port TCP/IP printers with TCPMON Xcv Commands Pin
TweakIt14-Feb-05 5:31
TweakIt14-Feb-05 5:31 
QuestionHow can I get ride of the 'X' that closes an application. Pin
mcgahanfl14-Feb-05 4:45
mcgahanfl14-Feb-05 4:45 
AnswerRe: How can I get ride of the 'X' that closes an application. Pin
John M. Drescher14-Feb-05 5:33
John M. Drescher14-Feb-05 5:33 
AnswerRe: How can I get ride of the 'X' that closes an application. Pin
Kippesoep14-Feb-05 6:36
Kippesoep14-Feb-05 6:36 
GeneralResource DLL Pin
Franz Klein14-Feb-05 4:13
Franz Klein14-Feb-05 4:13 
GeneralRe: Resource DLL Pin
rocky_pulley14-Feb-05 4:21
rocky_pulley14-Feb-05 4:21 

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.