getline function is giving unexpected results!!

I have used this function many times but for some reason I am not getting what I expect. I am writing a parser program, everything is working well but when I tried to get the first lexeme (word or operator) the program kept returning { which was not in the input file, I then tried to use getline() and I got this as a result: {\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf540

Does anyone have any idea why this occurred?? I am using a mac and i was not sure if using an rtf file as my input file made a difference

Here is the main function:
[code]

main()
{
ifstream datafile ("dataFile.rtf");
string line;

if (datafile.is_open())
{
while (! datafile.eof())
{
//char temp;
//temp = datafile.get();
// cout << temp << endl;

getline (datafile, line);
cout << line << endl;

getChar();

do
{
//lex();
}
while (nextToken != EOF);

}

} else {

cout << "ERROR - cannot open data.rtf \n";

}

}

Duplicate! Don't respond to this one. It is in the general C++ forum.
Topic archived. No new replies allowed.