Here's a tip, for what it's worth. With CString objects, unless you need to change the buffer directly, it's safer to use the const accessor methods (the LPCSTR cast or the GetString() method. CString::GetBuffer() is over-used (when not necessary) IMO :) (const unsigned char *)c.GetString(), instead of (const unsigned char *)c.GetBuffer(0), Mark