Click here to Skip to main content
15,903,033 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionDebug Assertion Failed Pin
MsmVc23-Feb-09 18:50
MsmVc23-Feb-09 18:50 
AnswerRe: Debug Assertion Failed Pin
«_Superman_»23-Feb-09 19:08
professional«_Superman_»23-Feb-09 19:08 
GeneralRe: Debug Assertion Failed Pin
MsmVc23-Feb-09 19:19
MsmVc23-Feb-09 19:19 
GeneralRe: Debug Assertion Failed Pin
CPallini23-Feb-09 20:40
mveCPallini23-Feb-09 20:40 
AnswerRe: Debug Assertion Failed Pin
KarstenK23-Feb-09 21:25
mveKarstenK23-Feb-09 21:25 
QuestionRe: Debug Assertion Failed Pin
David Crow24-Feb-09 3:28
David Crow24-Feb-09 3:28 
Questionusing vectors to parse text delimited files in C++ Pin
meixiang623-Feb-09 17:12
meixiang623-Feb-09 17:12 
AnswerRe: using vectors to parse text delimited files in C++ Pin
Stuart Dootson23-Feb-09 19:56
professionalStuart Dootson23-Feb-09 19:56 
Easiest way is to read each line into a string first, then use an istringstream to get the second token in that string:

#include <iterator>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

int main()
{
   ifstream ff( "test.txt", ios::in );
   if ( !ff.is_open() )
      return -1;

   string name;
   vector<string> names;

   while( !ff.eof() )
   {
      std::string line;
      std::getline(ff, line);
      std::istringstream iss(line);

      std::string first, second;

      iss >> first >> second;

      if (iss)
         names.push_back(second);
   }

   copy (names.begin(), names.end(), ostream_iterator<string>(cout,"\n"));

   return 0;
}


Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: using vectors to parse text delimited files in C++ Pin
meixiang624-Feb-09 5:03
meixiang624-Feb-09 5:03 
QuestionHelp with number to string conversion Pin
TabascoSauce23-Feb-09 14:09
TabascoSauce23-Feb-09 14:09 
AnswerRe: Help with number to string conversion Pin
Stuart Dootson23-Feb-09 14:26
professionalStuart Dootson23-Feb-09 14:26 
GeneralRe: Help with number to string conversion Pin
TabascoSauce23-Feb-09 15:32
TabascoSauce23-Feb-09 15:32 
QuestionNon-Static Member Call Question Pin
Rangarajan Varadan23-Feb-09 12:51
Rangarajan Varadan23-Feb-09 12:51 
AnswerRe: Non-Static Member Call Question Pin
Stuart Dootson23-Feb-09 13:53
professionalStuart Dootson23-Feb-09 13:53 
GeneralRe: Non-Static Member Call Question Pin
David Crow23-Feb-09 16:26
David Crow23-Feb-09 16:26 
GeneralRe: Non-Static Member Call Question Pin
Rangarajan Varadan25-Feb-09 10:40
Rangarajan Varadan25-Feb-09 10:40 
Questionread comma delimeted numbers and text mixture in a line [modified] Pin
mrby12323-Feb-09 12:08
mrby12323-Feb-09 12:08 
AnswerRe: read comma delimeted numbers and text mixture in a line Pin
Stuart Dootson23-Feb-09 12:40
professionalStuart Dootson23-Feb-09 12:40 
GeneralRe: read comma delimeted numbers and text mixture in a line Pin
mrby12323-Feb-09 12:47
mrby12323-Feb-09 12:47 
GeneralRe: read comma delimeted numbers and text mixture in a line Pin
Stuart Dootson23-Feb-09 13:48
professionalStuart Dootson23-Feb-09 13:48 
AnswerRe: read comma delimeted numbers and text mixture in a line Pin
David Crow23-Feb-09 16:29
David Crow23-Feb-09 16:29 
GeneralRe: read comma delimeted numbers and text mixture in a line Pin
mrby12323-Feb-09 16:47
mrby12323-Feb-09 16:47 
GeneralRe: read comma delimeted numbers and text mixture in a line Pin
David Crow24-Feb-09 2:40
David Crow24-Feb-09 2:40 
GeneralRe: read comma delimeted numbers and text mixture in a line Pin
mrby12323-Feb-09 19:05
mrby12323-Feb-09 19:05 
GeneralRe: read comma delimeted numbers and text mixture in a line Pin
David Crow24-Feb-09 2:23
David Crow24-Feb-09 2: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.