Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Use of CList

Posted on 1999-07-05
1
Medium Priority
?
250 Views
Last Modified: 2013-11-20
I would like to have a little sample code
regarding the use of the class CList.
How have I to declare a list of CString?


0
Comment
Question by:gilo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 3

Accepted Solution

by:
MDarling earned 800 total points
ID: 1308892
There is already a class called CStringList.

CStringList strings;

strings.AddTail("One");
strings.AddTail("Two");
strings.AddTail("Three");
POSITION pos=string.GetHeadPosition();
while(pos);
{
   CString str=strings.GetNext(pos);
   cout << str.GetBuffer(0) << endl;
}

if you really must use CList

#include <afxtempl.h>
...
        CList<CString,CString&> strings;
        strings.AddTail(CString("One"));
        strings.AddTail(CString("Two"));
        strings.AddTail(CString("Three"));
        POSITION pos= strings.GetHeadPosition();
        while(pos)
        {
           CString str=strings.GetNext(pos);
           cout << str.GetBuffer(0) << endl;
        }

regards,
mike.

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question