I am trying to create a long string literal, which I store inside a std::string. If I create a literal up to approximately 2600 characters, everything prints fine. If I go beyond that number of symbols, I only get some random garbage characters printed.
I have been using the C standard as guidance, environmental limits are specified as "4095 characters in a string literal (after concatenation)". But the code is written in C++.
So my question is, what is the minimum amount of characters in a C++ string literal?
(The problem might possibly be elsewhere in the code, but I would like to ensure that I don't pass a limit set by the standard. The text is printed in a RichEdit control, so I doubt that one is the culprit.)
std::string
, not string literals. – Seel...A
functions will be able to handle. I would suggest usingstrlen()
to determine the length of the literal and then asserting that the last few characters have the expected value. – Pazice