Sep 9, 2002 #1 golyg Programmer Jul 22, 2002 319 US Hi all, i am trying to set a variable through a pointer but I keep recieving an "Unhandled Exception in app.exe Access Violation" error. Any ideas why? thanks
Hi all, i am trying to set a variable through a pointer but I keep recieving an "Unhandled Exception in app.exe Access Violation" error. Any ideas why? thanks
Sep 9, 2002 #2 TGM IS-IT--Management Mar 14, 2001 141 BE Hi Suppose a int variable and a pointer to it: int nData = 2; int* pnData = &nData; Change the value as: *pnData = 10; Suppose you pass a pointer to a int in a function as: void TestFunction( int* pnData) To set up a variable in this function, use *pnData = 5; HTH Thierry Upvote 0 Downvote
Hi Suppose a int variable and a pointer to it: int nData = 2; int* pnData = &nData; Change the value as: *pnData = 10; Suppose you pass a pointer to a int in a function as: void TestFunction( int* pnData) To set up a variable in this function, use *pnData = 5; HTH Thierry
Sep 9, 2002 Thread starter #3 golyg Programmer Jul 22, 2002 319 US I think I may have mislead the problem, here is variable and a call to a function: nNewStatus = 0; m_pDoc->SetChargeStatus(nNewStatus); --------------------------------------------------------- here is the function: void CACMSDoc::SetChargeStatus(int nNewStatus) { m_nNewStatus = nNewStatus; } in the function, m_nNewStatus throws an exception. thanks for the help, m Upvote 0 Downvote
I think I may have mislead the problem, here is variable and a call to a function: nNewStatus = 0; m_pDoc->SetChargeStatus(nNewStatus); --------------------------------------------------------- here is the function: void CACMSDoc::SetChargeStatus(int nNewStatus) { m_nNewStatus = nNewStatus; } in the function, m_nNewStatus throws an exception. thanks for the help, m
Sep 9, 2002 #4 mingis Programmer Jan 23, 2002 475 LT Check initialization of pointer m_pDoc. Upvote 0 Downvote