Foros del Web » Programación para mayores de 30 ;) » C/C++ »

Error -1073741819 o (C0000005)

Estas en el tema de Error -1073741819 o (C0000005) en el foro de C/C++ en Foros del Web. Buenas, Estoy intentando añadir elementos "Vertex" a un vector de tipo Vertex pero sin embargo al ejecutar el programa y la rutina para hacerlo me ...
  #1 (permalink)  
Antiguo 19/04/2011, 07:57
 
Fecha de Ingreso: agosto-2009
Mensajes: 26
Antigüedad: 14 años, 8 meses
Puntos: 0
Error -1073741819 o (C0000005)

Buenas,

Estoy intentando añadir elementos "Vertex" a un vector de tipo Vertex pero sin embargo al ejecutar el programa y la rutina para hacerlo me sale el error del titulo del post.

Alguien me sabria explicar que es y como podria resolverlo?

Aqui teneis el codigo:

Funcion que da error
Código:
#include "joint.h"
#include <QDebug>


Joint::Joint()
{}

void Joint::addVertex(Vertex &v)
{
    vertexVector.push_back(v);
}

Vertex Joint::getVertex(int i)
{
    return vertexVector[i];
}

int Joint::numberVertex()
{
    return vertexVector.size();
}

void Joint::addJoint(Joint j)
{
    nextJoint->push_back(j);
}
Declaracion del vector (header de joint):
Código:
#ifndef JOINT_H
#define JOINT_H

#include "vector"
#include "vertex.h"

class Joint
{
public:
    Joint();
    void addVertex(Vertex &);
    void addJoint(Joint);
    Vertex getVertex(int);
    int numberVertex();

private:
    std::vector<Vertex> vertexVector;
    std::vector<Joint> *nextJoint;
};

#endif // JOINT_H
Llamada a la funcion en la clase llamada xml:
Código:
bool xml::loadData(const char* fileName, std::vector<Joint> *joints)
{
    qDebug() << "Checkpoint 2" <<endl;
    TiXmlDocument doc(fileName);
    bool loadOkay = doc.LoadFile();
    qDebug() << "Checkpoint 3" <<endl;
    if (loadOkay)
    {
      printf("\n%s:\n", fileName);
      qDebug() << "Checkpoint 4" <<endl;
      ProcessFile(joints, &doc ); // defined later in the tutorial
    }
    else
    {
      printf("Failed to load file \"%s\"\n", fileName);
    }
    return loadOkay;
}

void xml::ProcessFile(std::vector<Joint> *joints, TiXmlDocument* pParent )
{
    char * cstr, *word;
    string line;
    size_t found;
    Vertex v;

    ifstream file;
    file.open ("C:/Users/Marcus/Desktop/C++/ABB_IRB1600_145-0.STL");
    if (file.is_open())
    {
            while ( file.good() )
            {
                    getline(file,line);
                    found = line.find("vertex");
                    if(found != 0 && found < 1000)
                    {
                            line.erase(0,16);
                            cstr = new char [line.size()+1];
                            strcpy (cstr, line.c_str());
                            word = strtok(cstr," ");

                            v.x = atof(word);
                            word = strtok(NULL," ");
                            v.y = atof(word);
                            word = strtok(NULL," ");
                            v.z = atof(word);
                            word = strtok(NULL," ");

                            //ERROR AQUI!!!!
                            /**-|-|-|-|-|-|-|-|-|-|-|-|-|-**/
                            joints->front().addVertex(v);
                            /**-|-|-|-|-|-|-|-|-|-|-|-|-|-**/
                    }
            }
    }
    file.close();
   
}
El codigo de la funcion en xml.h:
Código:
void ProcessFile(std::vector<Joint> *joints, TiXmlDocument* pParent);

Etiquetas: Ninguno
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 21:57.