Click here to Skip to main content
14,110,477 members
Rate this:
 
Please Sign up or sign in to 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:
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
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

It is business as usual: you must do your house-keeping.

You must allocate you address struct in memory

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.
   
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?
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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)?
   

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web06 | 2.8.190518.1 | Last Updated 27 Oct 2015
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100