ifstream and getline

Jun 5, 2012 at 3:33am
What do i want to do is read from a file, one line at a time with the condition of stopping when a certain character or a couple of characters are encountered. From what i read about the matter, it seems that getline() should have 3 parameters. The first should be the input type (which in my case is ifstream with "input" name), the second a destination variable (in my case a string) and one third optional parameter which should be the stopping indicator. However, c++ doesn't seem to cooperate.

1
2
3
4
5
6
7
8

movie repository::rdmovie()
{
    ifstream input("data.txt");
    string n,d;
    getline(input, n , ".");
}


C:\Documents and Settings\Administrator\My Documents\lab_4\repository.cpp|23|error: no matching function for call to 'getline(std::ifstream&, std::string&, const char [2])'|

this is the error i get, and i simply do not understan'd what's wrong. Or if that is the case how the standard syntax for this getline function in this case would be.
Jun 5, 2012 at 3:45am
You want to use single quotes (' ') to denote a character.
Double quotes denote a string.
Jun 5, 2012 at 3:55am
that was a terrible thing to omit. excuse me while i shoot myself. in the dark. with a medieval musket. I'll see how can i get around this piece of info, and let's hope i won't show up for a decent amount of time.

Thank you for your time :D
Topic archived. No new replies allowed.