Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
E

Esaias Pech

@Esaias Pech
About
Posts
2
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to get IP Address of the system using MFC
    E Esaias Pech

    Thanks for the code! I just had to add the library Ws2_32.lib and the header Windows.h, works perfectly! Thanks!

    C / C++ / MFC c++ help tutorial question

  • Serialize Linked List
    E Esaias Pech

    I made a list of points:

    class CPuntoList : public CObject
    {

    public:
    CPunto* raiz;
    CPuntoList();
    void Inserta(CPunto* nodo);
    virtual ~CPuntoList();
    virtual void Serialize(CArchive &ar);
    long getSize();
    }

    The serialize function of the List looks like this:

    void CPuntoList::Serialize(CArchive &ar)
    {
    CObject::Serialize(ar);
    long i;
    if(ar.IsStoring())
    {
    ar<<raiz;
    }
    else
    {
    ar>>raiz;
    }
    }

    the Punto Class looks like this:

    class CPunto : public CObject
    {
    public:
    CPunto();
    CPunto(double _x, double _y, double _z, double _zTn);
    CPunto *m_pSigPunto; // Pointer to the next point
    CGLColor *m_pColor;
    void Inicializa();
    virtual ~CPunto();
    virtual void Serialize(CArchive& ar);
    public:
    double x, y, z, zTn;
    private:
    DECLARE_SERIAL(CPunto)
    };

    Serialize functino looks like this:

    void CPunto::Serialize(CArchive &ar)
    {
    CString str;

    if(ar.IsStoring())
    {
    	ar<<x;
    	ar<<y;
    	ar<<z;
    	ar<<zTn;
    	ar<<m\_pColor;
    	ar<<m\_pSigPunto;	//	Pointer to next point (Linked list)
    }
    else
    {
    	ar>>x;
    	ar>>y;
    	ar>>z;
    	ar>>zTn;
    	ar>>m\_pColor;
    	ar>>m\_pSigPunto;	//	Pointer to next point (Linked list)
    }	
    

    }

    Now the question is: When I load about 200 points to the list or even 5,000 points and I save the data to a file using the serialize functions everything works fine, both the storing and the loading. But when I try to save about 12,000 points, there is an error in both storing and loading, it says "Stack overflow." I think because from one function (the serialize function) I call the a serialize function over and over so the Stack overflows... Is that the problem? or what could be the issue? anyways, more importantly, how can I solve it?? Please help!!!!

    C / C++ / MFC help question data-structures
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups