In windows getline(,,) returns *this.
And Errors are signaled by modifying the internal state flags e.g. eofbit, failbit, badbit.
e.g. No characters were extracted -> then state flag = failbit

I want to do erro handling to this.
since this retuens pointer how can i do this. Can some one propose a solution??

I don't really understand what you are asking. But if you want to check if getline failed or not you could use something like this:

if (getline(your_stream, your_string, ' ') == failbit)
    cout << "something went wrong\n";
else 
    cout << "Extracted 1 word\n";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.