Click here to Skip to main content
15,912,977 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCString and string Pin
Star0926-May-07 6:03
Star0926-May-07 6:03 
AnswerRe: CString and string Pin
CPallini26-May-07 10:14
mveCPallini26-May-07 10:14 
AnswerRe: CString and string Pin
Michael Dunn26-May-07 20:45
sitebuilderMichael Dunn26-May-07 20:45 
QuestionHow to close previous form in Dialog based program Pin
Y_Kaushik26-May-07 4:10
Y_Kaushik26-May-07 4:10 
AnswerRe: How to close previous form in Dialog based program Pin
Manoj Kumar Rai26-May-07 9:35
professionalManoj Kumar Rai26-May-07 9:35 
GeneralRe: How to close previous form in Dialog based program Pin
Y_Kaushik27-May-07 19:36
Y_Kaushik27-May-07 19:36 
AnswerRe: How to close previous form in Dialog based program Pin
Demian Panello26-May-07 14:47
Demian Panello26-May-07 14:47 
QuestionThread blocking Pin
mehrdadov26-May-07 0:12
mehrdadov26-May-07 0:12 
AnswerRe: Thread blocking Pin
Taka Muraoka26-May-07 1:09
Taka Muraoka26-May-07 1:09 
GeneralRe: Thread blocking Pin
mehrdadov26-May-07 2:08
mehrdadov26-May-07 2:08 
GeneralRe: Thread blocking Pin
Taka Muraoka26-May-07 2:22
Taka Muraoka26-May-07 2:22 
AnswerRe: Thread blocking Pin
Arman S.26-May-07 1:31
Arman S.26-May-07 1:31 
GeneralRe: Thread blocking Pin
mehrdadov26-May-07 2:12
mehrdadov26-May-07 2:12 
GeneralRe: Thread blocking Pin
Mark Salsbery26-May-07 6:23
Mark Salsbery26-May-07 6:23 
Questionvector and map Pin
C_Zealot25-May-07 23:53
C_Zealot25-May-07 23:53 
AnswerSolution found but still buggy. Pin
C_Zealot26-May-07 0:28
C_Zealot26-May-07 0:28 
GeneralRe: Solution found but still buggy. Pin
Taka Muraoka26-May-07 1:11
Taka Muraoka26-May-07 1:11 
GeneralRe: Solution found but still buggy. Pin
C_Zealot26-May-07 1:15
C_Zealot26-May-07 1:15 
Questionpls help me Pin
deeps_cute25-May-07 22:18
deeps_cute25-May-07 22:18 
AnswerRe: pls help me Pin
Hans Dietrich26-May-07 15:01
mentorHans Dietrich26-May-07 15:01 
AnswerRe: pls help me Pin
Michael Dunn26-May-07 20:49
sitebuilderMichael Dunn26-May-07 20:49 
Question860305 - Alt+Tab in Emulator Pin
ilostmyid225-May-07 21:18
professionalilostmyid225-May-07 21:18 
QuestionProblem with pointer Pin
zeus200025-May-07 18:58
zeus200025-May-07 18:58 
Hi,

I have a big problem with the following code:

int _tmain(int argc, _TCHAR* argv[])
{
class2 *c2 = new class2();
class1 *c1 = new class1();
c1->doit(c2);

return 0;
}

class2::class2(void)
{
hold = new char*[2];
hold[0] = new char[10];
hold[1] = new char[10];
hold[0] = "test";
hold[1] = "me";
}
void class2::get(int index, char *result)
{
result = hold[index];
return;
}

class1::class1(void)
{
}
void class1::doit(class2 *c2)
{

c2->get(0, pszTmp);
c2->get(1, pszTmp);

return;
}

The Problem is that pszTmp never points to the arrays contents of the array hold.
When I run the code in the debugger it always stays a <bad pointer="">.
Does anyone know what I am making wrong?

P.S.: I am using Visual Studio 2005
AnswerRe: Problem with pointer Pin
Michael Dunn25-May-07 21:26
sitebuilderMichael Dunn25-May-07 21:26 
AnswerRe: Problem with pointer Pin
CPallini25-May-07 22:15
mveCPallini25-May-07 22:15 

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.