Get unformatted input with variable length

Is there any way to get unformatted input with variable length?

I know there's getline() but in order to use it you have to tell it the length of the stream and I don't have it.
why don´t you use "string"?
(I´m new user, don´t take me far too serious)
To use getline, you aren't required to know the length of the input, you simply need to know the istream object, the variable, and (optionally) the character delimiter (what's used to stop getline).

Some examples:
1
2
3
std::string myString;
std::cin.getline(myString); // My preference
std::getline(std::cin, myString, '\n'); // Reads until a new line is reached 
How do you determine the end of that variable length input? If it's up to the end of line or up to some sspecific delimiter, then it's std::getline (you don't have to tell it any length, it writes into a string, which expands as needed). If it's to the end of file, a convenient way is istreambuf_iterator<char>.
Ok thank you very much guys you helped me a lot.
Topic archived. No new replies allowed.