CString Mid function fails if size > 64K

I have a CString whose size is > 64K. I need to use the Mid of the string from 64300 to end.
But it returns only upto 65,535. But i need to get the whole string .  Is the best solution?
Who is Participating?
trestanConnect With a Mentor Commented:
I did not find the documentation about the length limit, may be it is sth about the memory. But to solve your problem, I think you can try this method:
int StartPosition = 64300;
OriginCStrn += '\0';
CString SubStrn = OriginCStrn[StartPosition];
OriginCStrn += OriginCStrn[StartPosition];
I think it should work. Or use GetAt() if it works. Pls try it. Good luck.
Where is the CString being created in memory?
Try doing a new CString (forcing it onto the heap).
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.