When using >> to extract data from an istream, are spaces skipped over? I.e., if I extracted every character from: "Hello, my name is not World.", would the 5 spaces not be read by >>?

If so, is this behavior omitted from istream::get()?

Thanks.

You can easily test your question yourself. Write a small program to find out how the >> operator behaves. I could easily tell you, but testing it out yourself is a much better teacher.

You can easily test your question yourself. Write a small program to find out how the >> operator behaves. I could easily tell you, but testing it out yourself is a much better teacher.

I had tried it, and the results I got led me to believe that the behavior I asked about above is correct (ie, >>: no spaces, get: spaces). I was just confirming it.

This article has been dead for over six months. Start a new discussion instead.