Hey all,
I am trying to read in a line from a file. The line will normally contain a string followed a number.
Eg/ NumberOfElements 1500
I only require the number.
I have been trying to read in the line storing the string as "text" and the number as "numOfInts".
I have delimited my getline with ' ', however the compiler doesnt seem to understand getline!
Error 1 error C3861: 'getline': identifier not found
Is there anyother way to get the number without the text? Or getting the current code to work.
I am using :-
#include <iostream>
#include "string.h"
#include "assert.h"
using namespace std;
istream& operator>>(istream &in, ArrayIntStorage &A){
int numOfInts;
string text;
getline(in, text, ' '); //Error
in >> numOfInts;
A._size = numOfInts;
A._text = text;
A.addArray(A);
for(int i=0;i<numOfInts;++i){
int value;
in >> value;
A._data[i] = value;
}
return in;
}
Many Thanks