Message 1 of 5
Pointer problem??
Not applicable
08-28-2002
12:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I think I'm having a problem with a pointer but cannot put my finger on
it. Can someone explain why this function would cause a fatal error?
m_StartSectionVerts & m_EndSectionVerts are declared as a private member
variables like this:
AcGePoint3d *m_StartSectionVerts;
AcGePoint3d *m_EndSectionVerts;
here is the function:
void MyObject::SetCrossSection(AcGePoint3d* verts, Adesk::UInt32
numVerts)
{
m_numStartSectionVerts = numVerts;
m_StartSectionVerts = new AcGePoint3d[(m_numStartSectionVerts - 1)];
m_StartSectionVerts = verts;
m_numEndSectionVerts = numVerts;
m_EndSectionVerts = new AcGePoint3d[(m_numEndSectionVerts - 1)];
for (int vertexNumber = 0; vertexNumber <= (m_numEndSectionVerts - 1);
vertexNumber++)
{
m_EndSectionVerts[vertexNumber] = verts[vertexNumber];
m_EndSectionVerts[vertexNumber] = verts[vertexNumber];
m_EndSectionVerts[vertexNumber] = 10.00;
acutPrintf("\nStart = %.3lf,%.3lf,%.3lf",
m_StartSectionVerts[vertexNumber],
m_StartSectionVerts[vertexNumber],
m_StartSectionVerts[vertexNumber] );
acutPrintf("\nEnd = %.3lf,%.3lf,%.3lf",
m_EndSectionVerts[vertexNumber], m_EndSectionVerts[vertexNumber],
m_EndSectionVerts[vertexNumber] );
}
}
it. Can someone explain why this function would cause a fatal error?
m_StartSectionVerts & m_EndSectionVerts are declared as a private member
variables like this:
AcGePoint3d *m_StartSectionVerts;
AcGePoint3d *m_EndSectionVerts;
here is the function:
void MyObject::SetCrossSection(AcGePoint3d* verts, Adesk::UInt32
numVerts)
{
m_numStartSectionVerts = numVerts;
m_StartSectionVerts = new AcGePoint3d[(m_numStartSectionVerts - 1)];
m_StartSectionVerts = verts;
m_numEndSectionVerts = numVerts;
m_EndSectionVerts = new AcGePoint3d[(m_numEndSectionVerts - 1)];
for (int vertexNumber = 0; vertexNumber <= (m_numEndSectionVerts - 1);
vertexNumber++)
{
m_EndSectionVerts[vertexNumber]
m_EndSectionVerts[vertexNumber]
m_EndSectionVerts[vertexNumber]
acutPrintf("\nStart = %.3lf,%.3lf,%.3lf",
m_StartSectionVerts[vertexNumber]
m_StartSectionVerts[vertexNumber]
m_StartSectionVerts[vertexNumber]
acutPrintf("\nEnd = %.3lf,%.3lf,%.3lf",
m_EndSectionVerts[vertexNumber]
m_EndSectionVerts[vertexNumber]
}
}