Thanks for the answers guys.

Philip:

I'm using wcslen(). So I think your hunch must be correct. I'll check in a minute or two.

mdmd:

The only excuse I can think of for not noticing that I don't need to pass in the length of the string is that maybe one day I'll need a class that can handle both strings, and arrays of unsigned shorts. Until I remove it a few minutes. I'll stand by it.

Steve:

The reason I was trying this is to speed up the loading of my program. The CStrings I feel are just an uncessesary overhead. The code runs on XP, and also windows CE 3.0. The CE machine is only 166Mhz! After loading a few thousand small CStrings from a text file a lot of time has gone past.

However, the main reason I'm reducing the CString usage is becuase I think my program is suffering from memory fragmentation caused by the constant resizing of the CStrings. It's very noticeable on the wince machine after about 10 or so hours continuous running. The strings loaded into this class are never modified, so why even need them in a CString? In other places I'm trying to use fixed length buffers instead of CStrings, and I'll maybe port the CStr class to unicode that's around in the projects somewhere (or is that codeproject?). It has it's own heap memory management apparently.

Oh and as my class isn't working it's currently commented out, and I've typedef'd CTextContainer to a CStringArray, and a small change where I called AddString().

vector<string>? STL isn't supported on Wince 3.0