getline function not working
Can someone please tell me which header to use for using getline() in C++. I have used
Code:
#include<iostream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
none of them seem to be working.
Here is the entire code that I have written so far
Code:
#include "stdafx.h"
#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<map>
using namespace std;
class TextQuery
{
typedef map<string, set<string::size_type> > word_map;
TextQuery(ifstream &file)
{
FillLineVector(file);
BuildMap(file);
}
void query(string);
private:
word_map map;
vector<string> LineVector;
void FillLineVector(const ifstream&);
void BuildMap(const ifstream&);
};
void TextQuery::FillLineVector(const ifstream& file)
{
string line;
while(getline(file,line)); //error:getline identifier not found
}