The extraction operator stops processing the line when it encounters a white space character.
it worked but why did i need to flush the buffer
This is being caused because you are mixing the extraction operator and getline(). The extraction operator leaves the end of line character in the input buffer and getline(), by default, stops processing when it encounters the end of line character.
sorry, do u mean the other way round because now, i m using the getline() before the extracter i.e does the getline() leave an end of line character in the input buffer which the extracter operator sees and starts to misbehave ?
i.e does the getline() leave an end of line character in the input buffer
No, getline() extracts and discards the delimiter.
Post the code that you're now having problems with and maybe someone can identify the problem.
By the way why are you using all those C-strings? You seem to be aware of C++ strings why not use them, they are much safer and don't require the nasty manual memory management you're trying to use.