How many characters can fit into a C ++ string?

I need to save a variable kbs or even mbs of plain text, so I want to know how many characters can fit in a standard string (aka std :: string plus a string library).

Thank.

+3
source share
2 answers

std::stringhas a member function max_size()that returns the maximum length std::stringin this implementation.

+8
source

It depends on your implementation. Try calling std :: string :: max_size () and find out.

+4
source

Source: https://habr.com/ru/post/1777254/


All Articles