Dieter
Dieter

Reputation: 51

Error C2026: string too big, trailing characters truntraced

i have a big problem and i dont know how to fix it...

I want to decode a very long Base64 encoded string (980.000 Chars) but every time when i to debug it i get this error :

Error C2026: string too big, trailing characters truntraced

I tried this but i can only compare 2 strings throught this method

char* toHash1 = "LONG BASE 64 Code";
char* toHash2 = "LONG BASE 64 Code";

if (true) {
  sprintf_s(output, outputSize, "%s", base64_decode(toHash1 =+ toHash2).c_str());
}

Anyone know how i can get it to work?

Upvotes: 5

Views: 5480

Answers (2)

Alok Saini
Alok Saini

Reputation: 311

You can first convert your string to hex and then can include it like this,

char data[] = {0xde,0xad,0xbe,0xef};  //example

And than can use it like a string, append null terminator if needed to.

Upvotes: 4

Baum mit Augen
Baum mit Augen

Reputation: 50091

As documented here, you can only have about 2048 characters in a string literal when using MSVC. You can get up to 65535 characters by concatenation, but since this is still too short, you cannot use string literals here.

One solution would be reading the string from a file into some allocated char buffer. I do not know of any such limits for gcc and clang, so trying to use them instead of MSVC could solve this too.

Upvotes: 5

Related Questions