Running out of heap-Space using String objects

DragonSF

Well-known member
I found a Q&D solution to prevent Strings allocating heap memory bei using EXTMEM buffers like that:
Code:
res[n].setBuffer(resbuf[n - stn], 1000); // res[] is in EXTMEM as well as resbuf[][]
res[n] = ename;
//This function does the magic:
    void String::setBuffer(char *b,int cap)
	{
		buffer = b;
		capacity = cap;
	}
Is there any other way, than using this? Or could setBuffer be added to the String class?
 
Back
Top