Click here to Skip to main content
15,886,664 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I need to insert some data from an edit control in a double linked list.
How can i make this?

My struct looks like this:
C#
typedef struct adr
{
    char anrede [5];
    char vorname [51];
    char nachname [51];
    char plz [8];
    char ort [60];
    char strasse [51];
    char land [24];
    char festnetz [14];
    char mobil [14];
    char mail [101];
    char geburtsdatum [11];
    char kategorie [31];
    char startnummer [5];
    char startzeit [9];
    char zeit [9];
    char rang [5];
    char fahrrad [31];
    char sponsor [31];
} adressen;

struct node
{
    adressen *konto;
    struct node *prev;
    struct node *next;
};
Posted

Get the CEdit text (you may either use the GetWindowText[^] method or, if appropriate, the DDX mechanism[^]) and copy it in the right adressen field.
Of course, you have to first allocate memory for the adressen structure.

As a side note, you are using C++ just like C. Why don't you take advantage of C++ features (like, for instance std::string and std::list)?
 
Share this answer
 
It is business as usual: you must do your house-keeping.

You must allocate you address struct in memory

C++
adressen * addr = new adressen;
//.. fill with data
// add to list
insert( node, addr );


and delete it when your done.

The inserting means that you "hang" the new between two old nodes.

A good tutorial.
 
Share this answer
 
Comments
Member 12041961 27-Oct-15 5:05am    
Thank's. One of my edit control has the datatype CString and is named m_vorname. How can i insert this into the double linked list?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900