Click here to Skip to main content
16,005,241 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Separating words and wrapping lines Pin
Ravi Bhavnani7-Apr-04 6:08
professionalRavi Bhavnani7-Apr-04 6:08 
GeneralRe: Separating words and wrapping lines Pin
David Crow7-Apr-04 7:16
David Crow7-Apr-04 7:16 
GeneralCFontDialog custom color selection Pin
aputic7-Apr-04 2:52
aputic7-Apr-04 2:52 
Generalgetline() Pin
dairiseky7-Apr-04 2:47
dairiseky7-Apr-04 2:47 
GeneralRe: getline() Pin
avenger_sb257-Apr-04 4:15
avenger_sb257-Apr-04 4:15 
GeneralRe: getline() Pin
PrashantJ7-Apr-04 4:18
PrashantJ7-Apr-04 4:18 
GeneralReaching an element of a std::list Pin
Jerome Conus7-Apr-04 2:09
Jerome Conus7-Apr-04 2:09 
GeneralRe: Reaching an element of a std::list Pin
Kevin McFarlane7-Apr-04 2:35
Kevin McFarlane7-Apr-04 2:35 
You probably want the advance() algorithm. There's a worked example in the VC online help...

// Advance.cpp
// compile with: /EHsc

#pragma warning (disable:4786)
#include <iostream>
#include <string>
#include <list>

using namespace std ;

typedef list<string> STRLIST;

int main() {
STRLIST List;
STRLIST::iterator iList;
STRLIST::difference_type dTheDiff;

List.push_back("A1");
List.push_back("B2");
List.push_back("C3");
List.push_back("D4");
List.push_back("E5");
List.push_back("F6");
List.push_back("G7");

// Print out the list
iList=List.begin();
cout << "The list is: ";
for (int i = 0; i < 7 ; i++, iList++)
cout << *iList << " ";

// Initialize to the first element"
iList=List.begin();
cout << "\n\nAdvance to the 3rd element." << endl;
advance(iList,2);
cout << "The element is " << *iList << endl;
dTheDiff = distance( List.begin(), iList);
}
Output
The list is: A1 B2 C3 D4 E5 F6 G7

Advance to the 3rd element.
The element is C3
Requirements
Header: <iterator>



Kevin
GeneralRe: Reaching an element of a std::list Pin
Diddy7-Apr-04 2:43
Diddy7-Apr-04 2:43 
GeneralDialog box Pin
Anonymous7-Apr-04 2:07
Anonymous7-Apr-04 2:07 
GeneralRe: Dialog box Pin
Ravi Bhavnani7-Apr-04 2:15
professionalRavi Bhavnani7-Apr-04 2:15 
QuestionADO Recordset default value? Pin
Shenthil7-Apr-04 1:50
Shenthil7-Apr-04 1:50 
AnswerRe: ADO Recordset default value? Pin
Sarvesvara (BVKS) Dasa7-Apr-04 2:02
Sarvesvara (BVKS) Dasa7-Apr-04 2:02 
QuestionThread count limit??? Pin
Anonymous7-Apr-04 0:50
Anonymous7-Apr-04 0:50 
AnswerRe: Thread count limit??? Pin
2249177-Apr-04 1:17
2249177-Apr-04 1:17 
GeneralRe: Thread count limit??? Pin
Anonymous7-Apr-04 2:34
Anonymous7-Apr-04 2:34 
AnswerRe: Thread count limit??? Pin
Tim Smith7-Apr-04 4:01
Tim Smith7-Apr-04 4:01 
GeneralRe: Thread count limit??? Pin
Anonymous7-Apr-04 4:14
Anonymous7-Apr-04 4:14 
GeneralRe: Thread count limit??? Pin
Anonymous7-Apr-04 4:15
Anonymous7-Apr-04 4:15 
GeneralHiding Menu Option in VC7 Pin
PrashantJ7-Apr-04 0:06
PrashantJ7-Apr-04 0:06 
GeneralUDP listen sockets don't get any data behind Firewall (ZoneAlarm) Pin
clayman876-Apr-04 23:36
clayman876-Apr-04 23:36 
GeneralBitmaps vs. CDC drawing functions Pin
adiior6-Apr-04 23:31
adiior6-Apr-04 23:31 
GeneralImplementing HTTP Client Pin
Madhavi Watve6-Apr-04 22:56
Madhavi Watve6-Apr-04 22:56 
GeneralRe: Implementing HTTP Client Pin
Ravi Bhavnani7-Apr-04 1:22
professionalRavi Bhavnani7-Apr-04 1:22 
GeneralRe: Implementing HTTP Client Pin
2249177-Apr-04 1:23
2249177-Apr-04 1:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.