Qbik
Qbik

Reputation: 6157

How long string could be read-in into string object using std::cin?

How long string could be read-in into string object using std::cin ? 10000 characters is possible ?

Upvotes: 1

Views: 305

Answers (1)

Adriano Repetti
Adriano Repetti

Reputation: 67128

cin is a stream so virtually there is no limit to number of characters you can read. If you buffer them all in memory you may run out of memory, of course, then the limit is given by memory size but 10,000 characters are pretty little (~20 KB if Unicode) then far away for any limit (even on a 16 machine...).

When cin is OS console then there may be a limit to the number of characters the user can enter but it depends on the OS (anyway you unlikely will get that limit).

Upvotes: 3

Related Questions