Click to See Complete Forum and Search --> : C++ String: What is the difference between 'CString' and std::string'?


Gabriel Fleseriu
February 14th, 2003, 04:04 AM
Q: What is the difference between 'CString' and 'std::string'?

A: 'CString' is a MFC class and can be used only for Windows programs that are statically or dynamically linked to the MFC. Use 'CString' when you write MFC programs.

'std::string' is a Standard C++ class - in other words, it is part of the C++ programming language. It is a very powerful class that can be used in any kind of Windows programs (MFC, Win32, Win32 Console) as well as in non-Windows programs.

'CString' and 'std::string' can be mixed, if you know what you are doing and you take some precautions.
<br><br>